### Install uv Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Install the uv package manager by running this command in your terminal. ```bash curl -LsSf https://astral.sh/uv/install.sh | sh ``` -------------------------------- ### Install macnotesapp with Homebrew Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Install the macnotesapp CLI using Homebrew after tapping the repository. This method is for Apple Silicon Macs. ```bash brew update brew install macnotesapp ``` -------------------------------- ### Display Help for 'add' Command Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Use this command to get detailed help for the 'add' command, including various ways to add notes and available options. ```bash Usage: notes add [OPTIONS] NOTE Add new note. There are multiple ways to add a new note: Add a new note from standard input (STDIN): notes add cat file.txt | notes add notes add < file.txt Add a new note by passing string on command line: notes add NOTE Add a new note by opening default editor (defined in $EDITOR or via `notes config`): notes add --edit notes add -e Add a new note from URL (downloads URL, creates a cleaned readable version to store in new Note): notes add --url URL notes add -u URL If NOTE is a single line, adds new note with name NOTE and no body. If NOTE is more than one line, adds new note where name is first line of NOTE and body is remainder. Body of note must be plain text unless --html/-h or --markdown/-m flag is set in which case body should be HTML or Markdown, respectively. If --edit/-e flag is set, note will be opened in default editor before being added. If --show/-s flag is set, note will be shown in Notes.app after being added. Account and top level folder may be specified with --account/-a and --folder/-f, respectively. If not provided, default account and folder are used. Options: -s, --show Show note in Notes after adding. -F, --file FILENAME -u, --url URL -h, --html Use HTML for body of note. -m, --markdown Use Markdown for body of note. -p, --plaintext Use plaintext for body of note (default unless changed in `notes config`). -e, --edit Edit note text before adding in default editor. -a, --account ACCOUNT Add note to account ACCOUNT. -f, --folder FOLDER Add note to folder FOLDER. --help Show this message and exit. ``` -------------------------------- ### Configure Default Settings Interactively Source: https://context7.com/rhettbull/macnotesapp/llms.txt The `notes config` command launches an interactive setup process to configure default settings for new notes, such as the default account and folder. This simplifies future note creation. ```bash notes config ``` -------------------------------- ### Install macnotesapp with uv Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Install the macnotesapp package using uv. Specify the desired Python version. ```bash uv tool install --python 3.13 macnotesapp ``` -------------------------------- ### Upgrade uv Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md If you have uv installed, use this command to upgrade to the latest version. ```bash uv self update ``` -------------------------------- ### Dump All Notes CLI Command Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use this command to output detailed information about all notes for debugging purposes. No special setup is required beyond having the CLI installed. ```bash # Dump all notes notes dump ``` -------------------------------- ### Initialize NotesApp and Get Account Info Source: https://context7.com/rhettbull/macnotesapp/llms.txt Initialize the NotesApp interface to access accounts, default account, and Notes.app version. Useful for understanding the current Notes.app environment. ```python from macnotesapp import NotesApp # Initialize the NotesApp interface notesapp = NotesApp() # Get list of all account names accounts = notesapp.accounts print(f"Available accounts: {accounts}") # Output: Available accounts: ['iCloud', 'On My Mac'] # Get the default account name default = notesapp.default_account print(f"Default account: {default}") # Output: Default account: iCloud # Get version of Notes.app version = notesapp.version print(f"Notes.app version: {version}") # Output: Notes.app version: 4.9 ``` -------------------------------- ### Sync Dependencies with uv Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Installs all project dependencies, including development dependencies, into a virtual environment. This command should be run after cloning the repository or updating dependencies. ```bash uv sync ``` -------------------------------- ### Run macnotesapp with uv Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Run macnotesapp without installing it using uv. Specify the desired Python version. ```bash uv tool run --python 3.13 macnotesapp ``` -------------------------------- ### Upgrade macnotesapp with uv Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Upgrade an existing macnotesapp installation to the latest version using uv. ```bash uv tool upgrade macnotesapp ``` -------------------------------- ### Run macnotesapp with uvx Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md An alternative way to run macnotesapp without installing it, using uvx. Specify the desired Python version. ```bash uvx --python 3.13 macnotesapp ``` -------------------------------- ### Tap macnotesapp repository Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Add the macnotesapp Homebrew tap to your system. This is a prerequisite for installing via Homebrew. ```bash brew tap RhetTbull/macnotesapp https://github.com/RhetTbull/macnotesapp ``` -------------------------------- ### Get All Notes as NotesList Source: https://context7.com/rhettbull/macnotesapp/llms.txt Retrieve all notes as a NotesList object for efficient bulk operations. This is faster than iterating through individual note objects. ```python from macnotesapp import NotesApp notesapp = NotesApp() # Get NotesList for all notes noteslist = notesapp.noteslist() print(f"Total notes: {len(noteslist)}") ``` -------------------------------- ### Get NotesList by Account Source: https://context7.com/rhettbull/macnotesapp/llms.txt Retrieve a NotesList containing notes from a specific account. Useful for organizing or processing notes from different sources. ```python # Get NotesList for specific accounts icloud_notes = notesapp.noteslist(accounts=["iCloud"]) ``` -------------------------------- ### Get All Notes as List of Dictionaries Source: https://context7.com/rhettbull/macnotesapp/llms.txt Convert all notes within a NotesList into a list of dictionaries. This provides a structured format for accessing note data in bulk. ```python # Get all notes as list of dictionaries notes_dicts = noteslist.asdict() for note_dict in notes_dicts: print(f"{note_dict['name']}: {note_dict['folder']}") print(f" Created: {note_dict['creation_date']}") print(f" Modified: {note_dict['modification_date']}") ``` -------------------------------- ### Get Note as Dictionary Source: https://context7.com/rhettbull/macnotesapp/llms.txt Convert a note object into a dictionary representation for easier data handling. This is useful for serialization or inspection. ```python note_dict = note.asdict() print(note_dict) ``` -------------------------------- ### JSON Output with Plaintext Body Source: https://context7.com/rhettbull/macnotesapp/llms.txt Combine the `--json` and `--plaintext` flags with `notes cat` to get a JSON output where the note's body is represented as plain text. This is useful for extracting raw text content from notes in a structured format. ```bash notes cat "Meeting Notes" --json --plaintext ``` -------------------------------- ### Deploy Documentation to GitHub Pages Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Deploys the built project documentation to GitHub Pages. This command should be run after the documentation has been successfully built. ```bash uv run mkdocs gh-deploy ``` -------------------------------- ### Build and Package Project Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Executes the build script to compile the project and prepare it for distribution. This script also builds the documentation. ```bash ./build.sh ``` -------------------------------- ### Build Project Documentation with mkdocs Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Generates the project's documentation using mkdocs. The documentation is stored in the `docs/` directory and built into static files. ```bash uv run mkdocs build ``` -------------------------------- ### List All Accounts (CLI) Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the command line to list all Notes.app accounts, including their IDs, names, note counts, and default folders. The output can be plain text or JSON. ```bash # List all accounts notes accounts # Output: # iCloud: # id: x-coredata://... # name: iCloud # notes_count: 42 # default_folder: Notes # On My Mac: # id: x-coredata://... # name: On My Mac # notes_count: 15 # default_folder: Notes # Output as JSON notes accounts --json # Output: # {"iCloud": {"id": "...", "name": "iCloud", "notes_count": 42, "default_folder": "Notes"}, ...} ``` -------------------------------- ### Create New Note with HTML Formatting (CLI) Source: https://context7.com/rhettbull/macnotesapp/llms.txt Create a new note using HTML content. The provided HTML string will be directly used as the note's body, preserving formatting. ```bash # Add note with HTML formatting notes add --html "Project Update " ``` -------------------------------- ### Show Note in Notes.app After Adding Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `--show` (or `-s`) flag with the `notes add` command to automatically open the newly created note in the native Notes.app. This is convenient for immediately reviewing or working with the note. ```bash notes add --show "Important Note" ``` ```bash notes add -s "View this note" ``` -------------------------------- ### Publish Project to PyPI Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Builds the project artifacts and then publishes them to the Python Package Index (PyPI). Ensure the project is built before publishing. ```bash uv build ``` ```bash uv publish ``` -------------------------------- ### Display Command Line Help Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md Use this command to display the general help message for the notes CLI tool. It outlines available commands and options. ```bash Usage: notes [OPTIONS] COMMAND [ARGS]... notes: work with Apple Notes on the command line. Options: -v, --version Show the version and exit. -h, --help Show this message and exit. Commands: accounts Print information about Notes accounts. add Add new note. cat Print one or more notes to STDOUT config Configure default settings for account, editor, etc. delete Delete a note. dump Dump all notes or selection of notes for debugging edit Edit an existing note's body. help Print help; for help on commands: help . list List notes, optionally filtering by account or text. mkdir Create a new folder. move Move a note to a different folder. rename Rename a note. rmdir Delete a folder. ``` -------------------------------- ### Create New Note from File (CLI) Source: https://context7.com/rhettbull/macnotesapp/llms.txt Create a new note by importing content from a local file. Supports plain text files and Markdown files using the --markdown flag. ```bash # Add note from file notes add --file /path/to/document.txt notes add -F notes.md --markdown ``` -------------------------------- ### Specify Account and Folder for New Note Source: https://context7.com/rhettbull/macnotesapp/llms.txt When adding a note, you can specify the target account and folder using the `--account` (or `-a`) and `--folder` (or `-f`) flags. This ensures the note is saved in the correct location, especially when managing multiple accounts or folders. ```bash notes add "Work Note" --account "iCloud" --folder "Projects" ``` ```bash notes add -a "On My Mac" -f "Personal" "Personal note" ``` -------------------------------- ### List All Notes Source: https://context7.com/rhettbull/macnotesapp/llms.txt The `notes list` command displays all notes, showing their folder, name, and a preview of the body. This provides a quick overview of your notes. ```bash notes list ``` -------------------------------- ### Create New Note from URL (CLI) Source: https://context7.com/rhettbull/macnotesapp/llms.txt Add a new note by fetching and extracting readable content from a given URL. The tool attempts to parse the main content of the webpage. ```bash # Add note from URL (extracts readable content) notes add --url https://example.com/article notes add -u https://blog.example.com/post ``` -------------------------------- ### notes config - Configure Defaults Source: https://context7.com/rhettbull/macnotesapp/llms.txt Allows interactive configuration of default settings for account, folder, format, and editor for new notes. ```APIDOC ## PUT /api/config - Configure Defaults ### Description Configures the default settings for the application, including the default account for new notes, the default folder, the default output format, and the default editor. ### Method PUT ### Endpoint /api/config ### Parameters #### Request Body - **default_account** (string) - Optional - The default account for new notes. - **default_folder** (string) - Optional - The default folder for new notes. - **default_format** (string) - Optional - The default format for note output (e.g., 'rich', 'plaintext', 'markdown', 'html', 'json'). - **default_editor** (string) - Optional - The default editor to use for composing notes. ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the configuration was updated. #### Response Example ```json { "message": "Default settings updated successfully." } ``` ``` -------------------------------- ### Create Folder in Specific Account Source: https://context7.com/rhettbull/macnotesapp/llms.txt To create a folder in a particular account, use the `--account` (or `-a`) flag with the `notes mkdir` command. This is useful when you manage notes across different services. ```bash notes mkdir "Work" --account "iCloud" ``` ```bash notes mkdir "Personal" -a "On My Mac" ``` -------------------------------- ### Create New Note from Text (CLI) Source: https://context7.com/rhettbull/macnotesapp/llms.txt Add a new note using a simple text string as the content. The first line of the text will be used as the note's title. ```bash # Add note from command line argument notes add "Quick Note" # Add note with multi-line content (first line becomes title) notes add "Meeting Notes - Discuss Q4 goals - Review budget - Assign action items" ``` -------------------------------- ### NotesApp - Main Application Interface Source: https://context7.com/rhettbull/macnotesapp/llms.txt The NotesApp class is the primary entry point for interacting with Notes.app. It provides access to accounts, notes, and methods for creating new notes in the default account. ```APIDOC ## NotesApp - Main Application Interface ### Description The `NotesApp` class is the primary entry point for interacting with Notes.app. It provides access to accounts, notes, and methods for creating new notes in the default account. ### Methods - `__init__()`: Initializes the NotesApp interface. - `accounts`: Property to get a list of all available account names. - `default_account`: Property to get the name of the default account. - `version`: Property to get the version of Notes.app. - `notes(accounts=None, name=None, body=None, text=None)`: Retrieves notes, with optional filtering by account, name, body content, or general text. - `selection`: Property to get the currently selected notes in the Notes.app UI. - `make_note(name, body, attachments=None)`: Creates a new note in the default account and folder. Supports name, body, and attachments. - `activate()`: Activates (brings to foreground) the Notes.app application. - `quit()`: Quits the Notes.app application. ### Iteration The `NotesApp` object is iterable, yielding `Note` objects for each note. ### Request Example ```python from macnotesapp import NotesApp # Initialize the NotesApp interface notesapp = NotesApp() # Get list of all account names accounts = notesapp.accounts print(f"Available accounts: {accounts}") # Get all notes as Note objects all_notes = notesapp.notes() print(f"Total notes: {len(all_notes)}") # Filter notes by name shopping_notes = notesapp.notes(name=["shopping"]) # Create a new note new_note = notesapp.make_note( name="Meeting Notes", body="
Discussion points for today's meeting
" ) print(f"Created note: {new_note.name}") # Activate Notes.app notesapp.activate() ``` ### Response Example ```json { "accounts": ["iCloud", "On My Mac"], "default_account": "iCloud", "version": "4.9", "total_notes": 150, "selected_note_names": ["Note 1", "Note 2"] } ``` ``` -------------------------------- ### Create a New Folder Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `notes mkdir` command to create a new folder within a Notes.app account. This helps in organizing your notes. ```bash notes mkdir "New Projects" ``` ```bash notes mkdir "Archive 2024" ``` -------------------------------- ### Open Editor to Compose Note Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `notes add --edit` or `notes add -e` command to open your default editor to compose a new note. This is ideal for longer notes where a rich text editing experience is preferred. ```bash notes add --edit ``` ```bash notes add -e ``` -------------------------------- ### Manage Notes and Attachments with NotesApp Source: https://context7.com/rhettbull/macnotesapp/llms.txt Create new notes with optional attachments, activate, quit, or iterate through all notes using the NotesApp interface. This covers basic note creation and application control. ```python # Get currently selected notes in Notes.app UI selected = notesapp.selection for note in selected: print(f"Selected: {note.name}") # Create a new note in default account/folder new_note = notesapp.make_note( name="Meeting Notes", body="
Discussion points for today's meeting
" ) print(f"Created note: {new_note.name} in {new_note.folder}") # Create note with attachments note_with_attachment = notesapp.make_note( name="Report", body="
See attached document
", attachments=["/Users/user/Documents/report.pdf"] ) # Activate Notes.app (bring to foreground) notesapp.activate() # Quit Notes.app notesapp.quit() # Iterate over all notes for note in notesapp: print(f"{note.name}: {note.folder}") ``` -------------------------------- ### notes mkdir - Create Folder Source: https://context7.com/rhettbull/macnotesapp/llms.txt Creates a new folder within a specified account in the Notes.app. ```APIDOC ## POST /api/folders - Create Folder ### Description Creates a new folder within a specified account. ### Method POST ### Endpoint /api/folders ### Parameters #### Query Parameters - **name** (string) - Required - The name of the new folder. - **account** (string) - Optional - Specify the account in which to create the folder. ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the folder was created. - **folder** (object) - The newly created folder object. - **name** (string) - The name of the folder. - **account** (string) - The account where the folder was created. #### Response Example ```json { "message": "Folder 'New Projects' created successfully.", "folder": { "name": "New Projects", "account": "iCloud" } } ``` ``` -------------------------------- ### NotesApp Module Source: https://github.com/rhettbull/macnotesapp/blob/main/docs/reference.md Documentation for the main NotesApp module. ```APIDOC ## NotesApp Module ### Description Provides core functionalities for the Notes application. ### Class macnotesapp.notesapp.NotesApp ``` -------------------------------- ### Dump Selected Notes CLI Command Source: https://context7.com/rhettbull/macnotesapp/llms.txt Outputs detailed information for only the currently selected notes in the Notes.app. Use the '-s' or '--selected' flag. ```bash # Dump only selected notes in Notes.app notes dump --selected notes dump -s ``` -------------------------------- ### Display Note as HTML Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `--html` (or `-h`) flag with `notes cat` to display the note's content formatted as HTML. This is useful for web-related tasks or when the note contains HTML markup. ```bash notes cat "Meeting Notes" --html ``` ```bash notes cat "Meeting Notes" -h ``` -------------------------------- ### notes add - Add a New Note Source: https://context7.com/rhettbull/macnotesapp/llms.txt Commands for adding new notes, with options for Markdown formatting, opening an editor, specifying accounts and folders, and showing the note after creation. ```APIDOC ## POST /api/notes (Add Note) ### Description Adds a new note to the application. Supports Markdown formatting, opening an editor for composition, specifying account and folder, and displaying the note after creation. ### Method POST ### Endpoint /api/notes ### Parameters #### Query Parameters - **markdown** (boolean) - Optional - Use Markdown formatting for the note content. - **edit** (boolean) - Optional - Open the default editor to compose the note. - **account** (string) - Optional - Specify the account for the note. - **folder** (string) - Optional - Specify the folder for the note. - **show** (boolean) - Optional - Display the note in the Notes.app after adding. ### Request Body - **title** (string) - Required - The title of the note. - **body** (string) - Optional - The content of the note. If not provided and `--edit` is not used, the note will be empty. ### Request Example ```json { "title": "Project Status", "body": "# Project Status\n- [x] Design complete\n- [ ] Development in progress\n- [ ] Testing pending" } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the newly created note. - **title** (string) - The title of the note. - **account** (string) - The account where the note was saved. - **folder** (string) - The folder where the note was saved. #### Response Example ```json { "id": "uuid-for-the-note", "title": "Project Status", "account": "iCloud", "folder": "Projects" } ``` ``` -------------------------------- ### Folder Module Source: https://github.com/rhettbull/macnotesapp/blob/main/docs/reference.md Documentation for the Folder module. ```APIDOC ## Folder Module ### Description Manages folder creation, deletion, and organization. ### Class macnotesapp.notesapp.Folder ``` -------------------------------- ### Create New Note from Stdin (CLI) Source: https://context7.com/rhettbull/macnotesapp/llms.txt Generate a new note by piping content from standard input. This is useful for scripting or redirecting output from other commands. ```bash # Add note from stdin echo "Note content here" | notes add cat document.txt | notes add ``` -------------------------------- ### Python: Interact with NotesApp Source: https://github.com/rhettbull/macnotesapp/blob/main/README.md This Python script demonstrates how to use the NotesApp class to interact with Apple Notes. It covers fetching notes, creating new notes, and searching notes. ```python """Example code for working with macnotesapp""" from macnotesapp import NotesApp # NotesApp() provides interface to Notes.app notesapp = NotesApp() # Get list of notes (Note objects for each note) notes = notesapp.notes() note = notes[0] print( note.id, note.account, note.folder, note.name, note.body, note.plaintext, note.password_protected, ) print(note.asdict()) # Get list of notes for one or more specific accounts notes = notesapp.notes(accounts=["iCloud"]) # Create a new note in default folder of default account new_note = notesapp.make_note( name="New Note", body="This is a new note created with #macnotesapp" ) # Create a new note in a specific folder of a specific account account = notesapp.account("iCloud") account.make_note( "My New Note", "This is a new note created with #macnotesapp", folder="Notes" ) # If working with many notes, it is far more efficient to use the NotesList object # Find all notes with "#macnotesapp" in the body noteslist = notesapp.noteslist(body=["#macnotesapp"]) print(f"There are {len(noteslist)} notes with #macnotesapp in the body") # List of names of notes in noteslist note_names = noteslist.name print(note_names) ``` -------------------------------- ### NotesList Module Source: https://github.com/rhettbull/macnotesapp/blob/main/docs/reference.md Documentation for the NotesList module. ```APIDOC ## NotesList Module ### Description Handles the listing and management of multiple notes. ### Class macnotesapp.notesapp.NotesList ``` -------------------------------- ### Move Note with Account Specification Source: https://context7.com/rhettbull/macnotesapp/llms.txt If a note with the same name exists in multiple accounts, use the `--account` (or `-a`) flag along with `--folder` (or `-f`) in the `notes move` command to specify the source account and the destination folder. This ensures the correct note is moved. ```bash notes move "Work Note" --folder "Projects" --account "iCloud" ``` -------------------------------- ### MacNotesApp CLI Commands Source: https://github.com/rhettbull/macnotesapp/blob/main/docs/cli.md Reference for all commands available through the 'notes' CLI. ```APIDOC ## MacNotesApp CLI Reference This document outlines the command-line interface for the MacNotesApp, accessible via the `notes` command. ### Usage ```bash notes [OPTIONS] COMMAND [ARGS]... ``` ### Commands * **add**: Add a new note. * **list**: List existing notes. * **search**: Search for notes. * **delete**: Delete a note. * **edit**: Edit an existing note. ### Global Options * **--help**: Show a help message and exit. ### Example Usage To add a new note: ```bash notes add "My first note" --content "This is the body of the note." ``` To list all notes: ```bash notes list ``` To search for notes containing 'important': ```bash notes search important ``` ``` -------------------------------- ### Combine Filters for Listing Notes Source: https://context7.com/rhettbull/macnotesapp/llms.txt The `notes list` command allows combining text search and account filters to narrow down the results. This enables precise retrieval of specific notes across different accounts. ```bash notes list --account iCloud "quarterly" ``` -------------------------------- ### Display Note as Markdown Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `--markdown` (or `-m`) flag with `notes cat` to display the note's content formatted as Markdown. This is helpful for previewing or exporting notes in Markdown format. ```bash notes cat "Meeting Notes" --markdown ``` ```bash notes cat "Meeting Notes" -m ``` -------------------------------- ### Display Note Content Source: https://context7.com/rhettbull/macnotesapp/llms.txt The `notes cat` command displays the full content of a specified note. By default, it shows rich formatted output. ```bash notes cat "Meeting Notes" ``` -------------------------------- ### Account Module Source: https://github.com/rhettbull/macnotesapp/blob/main/docs/reference.md Documentation for the Account module. ```APIDOC ## Account Module ### Description Handles user account related operations. ### Class macnotesapp.notesapp.Account ``` -------------------------------- ### Show Note in UI Source: https://context7.com/rhettbull/macnotesapp/llms.txt Display a specific note within the native Notes.app user interface. This action brings the note to the foreground for the user. ```python note.show() ``` -------------------------------- ### Activate Virtual Environment Manually Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Activates the project's virtual environment in the current shell session. This allows running commands directly without `uv run`. ```bash source .venv/bin/activate ``` -------------------------------- ### Run Commands within Virtual Environment using uv Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Executes commands within the project's virtual environment managed by uv. Use this for running the application, tests, or other development tools. ```bash uv run notes --help ``` ```bash uv run pytest -v -s tests/ ``` -------------------------------- ### Add Note with Markdown Formatting Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `notes add --markdown` command to create a new note with content formatted in Markdown. This is useful for notes that require structured text, lists, or emphasis. ```bash notes add --markdown "# Project Status - [x] Design complete - [ ] Development in progress - [ ] Testing pending" ``` -------------------------------- ### Specify Account for Editing Notes with Same Name Source: https://context7.com/rhettbull/macnotesapp/llms.txt If you have multiple notes with the same name in different accounts, use the `--account` flag with `notes edit` to specify which note to modify. This prevents ambiguity and ensures the correct note is updated. ```bash notes edit "Project Notes" --account "iCloud" ``` -------------------------------- ### Note Module Source: https://github.com/rhettbull/macnotesapp/blob/main/docs/reference.md Documentation for the Note module. ```APIDOC ## Note Module ### Description Provides functionalities for creating, editing, and retrieving notes. ### Class macnotesapp.notesapp.Note ``` -------------------------------- ### Display Note as Plain Text Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `--plaintext` (or `-p`) flag with `notes cat` to display the note's content as plain text, stripping any formatting. This is useful for processing note content in scripts or other tools. ```bash notes cat "Meeting Notes" --plaintext ``` ```bash notes cat "Meeting Notes" -p ``` -------------------------------- ### Filter Notes by Account Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `--account` (or `-a`) flag with `notes list` to display notes only from a specific account. This is useful for organizing and retrieving notes associated with different services like iCloud or 'On My Mac'. ```bash notes list --account iCloud ``` ```bash notes list -a "On My Mac" ``` -------------------------------- ### Attachment Module Source: https://github.com/rhettbull/macnotesapp/blob/main/docs/reference.md Documentation for the Attachment module. ```APIDOC ## Attachment Module ### Description Manages attachments associated with notes. ### Class macnotesapp.notesapp.Attachment ``` -------------------------------- ### Access and Save Note Attachments Source: https://context7.com/rhettbull/macnotesapp/llms.txt Retrieve attachments associated with a note, print their properties, and save them to a specified directory. Ensure the directory exists. ```python note = notesapp.notes(name=["Report"])[0] attachments = note.attachments for attachment in attachments: print(f"Attachment: {attachment.name}") print(f" ID: {attachment.id}") print(f" Created: {attachment.creation_date}") print(f" Modified: {attachment.modification_date}") print(f" Content ID: {attachment.content_identifier}") print(f" URL: {attachment.URL}") # For URL attachments # Save attachment to disk saved_path = attachment.save("/Users/user/Downloads") print(f" Saved to: {saved_path}") ``` -------------------------------- ### Retrieve and Filter Notes with NotesApp Source: https://context7.com/rhettbull/macnotesapp/llms.txt Fetch all notes or filter them by account, name, body content, or general text search. This is useful for finding specific notes programmatically. ```python # Get all notes as Note objects all_notes = notesapp.notes() print(f"Total notes: {len(all_notes)}") # Filter notes by account icloud_notes = notesapp.notes(accounts=["iCloud"]) # Filter notes by name (case-insensitive, partial match) shopping_notes = notesapp.notes(name=["shopping"]) # Filter notes by body content tagged_notes = notesapp.notes(body=["#project"]) # Filter by text (searches both name and body) search_results = notesapp.notes(text=["meeting"]) ``` -------------------------------- ### Read Note Properties Source: https://context7.com/rhettbull/macnotesapp/llms.txt Access and print various properties of a note object. Ensure the note object is valid and accessible. ```python print(f"ID: {note.id}") print(f"Name: {note.name}") print(f"Account: {note.account}") print(f"Folder: {note.folder}") print(f"Body (HTML): {note.body}") print(f"Body (plain text): {note.plaintext}") print(f"Password protected: {note.password_protected}") print(f"Created: {note.creation_date}") print(f"Modified: {note.modification_date}") ``` -------------------------------- ### Bump Project Version with bump2version Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Increments the project's version number (major, minor, or patch) using bump2version. This command should be run within the uv-managed virtual environment. ```bash uv run bump2version --verbose ``` -------------------------------- ### notes list - List Notes Source: https://context7.com/rhettbull/macnotesapp/llms.txt Lists existing notes, with options to filter by account and search by text within the note's name and body. ```APIDOC ## GET /api/notes - List Notes ### Description Retrieves a list of notes. Supports filtering by account and searching for notes by text content (name and body). ### Method GET ### Endpoint /api/notes ### Parameters #### Query Parameters - **account** (string) - Optional - Filter notes by the specified account. - **search** (string) - Optional - Search term to filter notes by name and body content. ### Response #### Success Response (200) - **notes** (array) - An array of note objects. - **folder** (string) - The folder the note belongs to. - **name** (string) - The name/title of the note. - **body** (string) - A preview of the note's content. #### Response Example ```json { "notes": [ { "folder": "Notes", "name": "Meeting Notes", "body": "Discussion points for today's meeting..." }, { "folder": "Projects", "name": "Q4 Planning", "body": "Goals and objectives for Q4..." } ] } ``` ``` -------------------------------- ### Access NotesList Properties as Lists Source: https://context7.com/rhettbull/macnotesapp/llms.txt Efficiently access note properties (like IDs, names, bodies) as lists directly from a NotesList object. This avoids slow iteration. ```python # Access properties as lists (much faster than iterating Note objects) all_ids = noteslist.id all_names = noteslist.name all_bodies = noteslist.body all_plaintext = noteslist.plaintext all_folders = noteslist.folder all_creation_dates = noteslist.creation_date all_modification_dates = noteslist.modification_date all_password_status = noteslist.password_protected ``` -------------------------------- ### Delete a Note with Confirmation Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `notes delete` command to permanently remove a note. By default, it prompts for confirmation before deletion. This is a safety measure to prevent accidental data loss. ```bash notes delete "Old Note" ``` -------------------------------- ### Output Note Content as JSON Source: https://context7.com/rhettbull/macnotesapp/llms.txt The `notes cat` command can output note content in JSON format using the `--json` (or `-j`) flag. This is ideal for programmatic access and integration with other applications. ```bash notes cat "Meeting Notes" --json ``` ```bash notes cat "Meeting Notes" -j ``` -------------------------------- ### Run Interactive Tests with pytest Source: https://github.com/rhettbull/macnotesapp/blob/main/README_DEV.md Executes the test suite using pytest with verbose output and interactive mode enabled (`-s`). The tests operate on actual Notes.app data and may require user input. ```bash uv run pytest -v -s tests/ ``` -------------------------------- ### Rename Note with Account Specification Source: https://context7.com/rhettbull/macnotesapp/llms.txt When renaming a note that might have duplicates across accounts, use the `--account` (or `-a`) flag to specify the account from which the note should be renamed. This ensures the correct note is targeted. ```bash notes rename "Meeting Notes" "Team Meeting 2024-01-15" --account iCloud ``` ```bash notes rename "Draft" "Final Report" -a "On My Mac" ``` -------------------------------- ### Move Note to Folder Source: https://context7.com/rhettbull/macnotesapp/llms.txt Relocate a note to a different folder. Provide the target folder name as a string argument to the 'move' method. ```python note.move("Archive") ``` -------------------------------- ### Account - Notes Account Management Source: https://context7.com/rhettbull/macnotesapp/llms.txt The Account class represents a Notes.app account (e.g., iCloud, On My Mac) and provides methods for working with notes and folders within that account. ```APIDOC ## Account - Notes Account Management ### Description The `Account` class represents a Notes.app account (e.g., iCloud, On My Mac) and provides methods for working with notes and folders within that account. ### Properties - `name` (string): The name of the account. - `id` (string): The unique identifier for the account. - `default_folder` (string): The name of the default folder for this account. - `folders` (list): A list of folder names within the account. ### Methods - `__init__(notesapp, account_name)`: Initializes an Account object. - `notes(name=None, body=None)`: Retrieves notes within this account, with optional filtering by name or body content. - `make_note(name, body, folder=None, attachments=None)`: Creates a new note within a specified folder of this account. Supports name, body, folder, and attachments. - `make_folder(folder_name)`: Creates a new folder within the account. - `delete_folder(folder_name)`: Deletes a folder and all its contents from the account. - `folder(folder_name)`: Retrieves a specific `Folder` object by name. - `show()`: Displays the account in the Notes.app UI. ### Iteration The `Account` object is iterable, yielding `Note` objects for each note within the account. ### Request Example ```python from macnotesapp import NotesApp notesapp = NotesApp() # Get a specific account by name account = notesapp.account("iCloud") # Get account properties print(f"Account name: {account.name}") print(f"Default folder: {account.default_folder}") # Get all notes in account notes = account.notes() # Create a new note in specific folder new_note = account.make_note( name="Project Update", body="
Status update for Q4
", folder="Projects" ) # Create a new folder new_folder = account.make_folder("Archive 2024") # Delete a folder account.delete_folder("Old Projects") ``` ### Response Example ```json { "account_name": "iCloud", "account_id": "A1B2C3D4-E5F6-7890-1234-567890ABCDEF", "default_folder": "Notes", "folders": ["Notes", "Archive", "Projects"], "note_count": 100 } ``` ``` -------------------------------- ### Add Attachment to Note Source: https://context7.com/rhettbull/macnotesapp/llms.txt Append a new attachment to an existing note. Provide the file path of the attachment to the 'add_attachment' method. ```python new_attachment = note.add_attachment("/Users/user/Documents/chart.png") print(f"Added attachment: {new_attachment.name}") ``` -------------------------------- ### Filter NotesList Source: https://context7.com/rhettbull/macnotesapp/llms.txt Create a filtered NotesList based on criteria like body content or name. This allows for targeted retrieval of notes. ```python # Filter notes when creating NotesList project_notes = notesapp.noteslist(body=["#project"]) recent_notes = notesapp.noteslist(name=["2024"]) ``` -------------------------------- ### notes move - Move Note to Folder Source: https://context7.com/rhettbull/macnotesapp/llms.txt Moves a specified note to a different folder within the same account, with options to specify both the target folder and the account. ```APIDOC ## PUT /api/notes/{note_name}/move - Move Note to Folder ### Description Moves a specified note to a different folder within the same account. Allows specifying the target folder and the account. ### Method PUT ### Endpoint /api/notes/{note_name}/move ### Parameters #### Path Parameters - **note_name** (string) - Required - The name or title of the note to move. #### Query Parameters - **folder** (string) - Required - The name of the destination folder. - **account** (string) - Optional - Specify the account to which the note belongs. ### Response #### Success Response (200) - **message** (string) - Confirmation message indicating the note was moved. - **note** (object) - The moved note object. - **id** (string) - The unique identifier of the note. - **name** (string) - The name/title of the note. - **folder** (string) - The new folder the note is in. #### Response Example ```json { "message": "Note 'Meeting Notes' moved to folder 'Archive'.", "note": { "id": "uuid-for-the-note", "name": "Meeting Notes", "folder": "Archive" } } ``` ``` -------------------------------- ### Update Note Body Directly Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `--body` (or `-b`) flag with `notes edit` to set the note's content directly without opening an editor. This is efficient for quick updates or programmatic modifications. ```bash notes edit "Meeting Notes" --body "Updated content" ``` ```bash notes edit "Meeting Notes" -b "New body text" ``` -------------------------------- ### notes cat - Display Note Content Source: https://context7.com/rhettbull/macnotesapp/llms.txt Displays the full content of one or more notes in various formats including plain text, Markdown, HTML, and JSON. ```APIDOC ## GET /api/notes/{note_name} - Display Note Content ### Description Retrieves and displays the full content of a specified note. Supports outputting content in rich format, plain text, Markdown, HTML, or JSON. ### Method GET ### Endpoint /api/notes/{note_name} ### Parameters #### Path Parameters - **note_name** (string) - Required - The name or title of the note to display. #### Query Parameters - **plaintext** (boolean) - Optional - Output the note content as plain text. - **markdown** (boolean) - Optional - Output the note content in Markdown format. - **html** (boolean) - Optional - Output the note content in HTML format. - **json** (boolean) - Optional - Output the note content as a JSON object. ### Response #### Success Response (200) - **note** (object) - The note object containing its details and content. - **id** (string) - The unique identifier of the note. - **name** (string) - The name/title of the note. - **body** (string) - The content of the note (format depends on query parameters). - **creation_date** (string) - The date and time the note was created. - **modification_date** (string) - The date and time the note was last modified. - **account** (string) - The account the note belongs to. - **folder** (string) - The folder the note is in. - **password_protected** (boolean) - Indicates if the note is password protected. #### Response Example (JSON Output) ```json [ { "id": "x-coredata://...", "name": "Meeting Notes", "body": "
...
", "creation_date": "2024-01-15T10:30:00", "modification_date": "2024-01-16T14:22:00", "account": "iCloud", "folder": "Notes", "password_protected": false } ] ``` ``` -------------------------------- ### Filter Notes by Text Search Source: https://context7.com/rhettbull/macnotesapp/llms.txt You can filter the list of notes by providing a search term to the `notes list` command. The search term will be matched against both the note's name and its body content. ```bash notes list "meeting" ``` ```bash notes list "project update" ``` -------------------------------- ### Dump Notes Without Body CLI Command Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use this command to dump note information excluding the body content, which can be useful for reducing output size during debugging. Use the '-B' or '--no-body' flag. ```bash # Dump without body content notes dump --no-body notes dump -B ``` -------------------------------- ### Set Note Body with Markdown Formatting Source: https://context7.com/rhettbull/macnotesapp/llms.txt Use the `--markdown` (or `-m`) flag with `notes edit --body` to update a note's content with Markdown formatting. This is useful for applying Markdown syntax directly to the note's body. ```bash notes edit "Meeting Notes" --body "# Updated\n- Point 1\n- Point 2" --markdown ``` ```bash notes edit "Meeting Notes" -b "**Bold** and *italic*" -m ``` -------------------------------- ### Note - Individual Note Operations Source: https://context7.com/rhettbull/macnotesapp/llms.txt The Note class represents a single note and provides properties and methods for reading and modifying note content, managing attachments, and organizing notes. ```APIDOC ## Note - Individual Note Operations ### Description The `Note` class represents a single note and provides properties and methods for reading and modifying note content, managing attachments, and organizing notes. ### Properties - `id` (string): The unique identifier for the note. - `name` (string): The title or name of the note. - `folder` (string): The name of the folder the note belongs to. - `account` (string): The name of the account the note belongs to. - `creation_date` (datetime): The date and time the note was created. - `modification_date` (datetime): The date and time the note was last modified. - `body` (string): The content of the note (can be HTML). - `attachments` (list): A list of file paths for any attachments associated with the note. ### Methods - `save()`: Saves any changes made to the note. - `delete()`: Deletes the note. - `move(folder_name, account_name=None)`: Moves the note to a different folder, optionally in another account. - `add_attachment(file_path)`: Adds an attachment to the note. - `remove_attachment(file_path)`: Removes an attachment from the note. ### Request Example ```python from macnotesapp import NotesApp notesapp = NotesApp() # Get a note by name notes = notesapp.notes(name=["Meeting Notes"]) if notes: note = notes[0] # Read note properties print(f"Note Name: {note.name}") print(f"Folder: {note.folder}") print(f"Content: {note.body}") # Modify note content note.body = "
Updated discussion points.
" note.save() # Add an attachment note.add_attachment("/Users/user/Documents/followup.pdf") # Delete the note # note.delete() else: print("Note not found.") ``` ### Response Example ```json { "note_id": "N1A2B3C4-D5E6-7890-1234-567890ABCDEF", "name": "Meeting Notes", "folder": "Notes", "account": "iCloud", "creation_date": "2023-10-27T10:00:00Z", "modification_date": "2023-10-27T11:30:00Z", "body_preview": "
Updated discussion points.
", "attachment_count": 1 } ``` ``` -------------------------------- ### Set Note Body with HTML Formatting Source: https://context7.com/rhettbull/macnotesapp/llms.txt When updating a note's body using `notes edit --body`, you can specify HTML formatting by including HTML tags in the provided string. Use the `--html` (or `-h`) flag to ensure it's interpreted as HTML. ```bash notes edit "Meeting Notes" --body "
Formatted content
" --html ``` ```bash notes edit "Meeting Notes" -b "" -h ``` -------------------------------- ### Retrieve a Specific Note by Name Source: https://context7.com/rhettbull/macnotesapp/llms.txt Fetch a specific note object by its name using the NotesApp interface. This is a common operation for accessing and potentially modifying individual notes. ```python from macnotesapp import NotesApp notesapp = NotesApp() # Get a note by name notes = notesapp.notes(name=["Meeting Notes"]) note = notes[0] ``` -------------------------------- ### Edit Existing Note Source: https://context7.com/rhettbull/macnotesapp/llms.txt The `notes edit` command allows you to modify an existing note. You can open the note in your default editor or directly update its content from the command line. ```bash notes edit "Meeting Notes" ```