import subprocess
import re
import os

notes_to_export = [
    "TattooClaw 🦞 AI Studio Management",
    "# Square Setup Guide for Rocky Mountain Tattoo",
    "RMT AI-NATIVE CONTEXT SYSTEM BUILD",
    "system ontology / SSOT excavations      RMT AI-NATIVE CONTEXT SYSTEM",
    "RMT WEBAPP    {locations}  Kelowna (downtown) West Kelowna",
    "IMAGES PROMPT BOOT      This is the RMT Hyper-Realism Protocol.",
    "rmt gmail - PasswordimusRMThq!!!",
    "RMT VANCITY    Rocky Mountain Tattoo — Vancouver Launch Master Plan",
    "website context graph     RMT Website — Purpose & Experience Context",
    "## RMT - Vancouver: Revenue Streams",
    "# RMT Knowledge Graph — Quick Query Cheats",
    "RMT AUTOMATION        user enters website and is facing AI RMT agent",
    "RMT AI    [ TRAINING plan ]",
    "<!-- RMT Lite Artist Price Calculator (Drop into a Wix HTML Embed",
    "To-Do List (Kelowna / Downtown / General)",
    "BOOKIN FORM",
    "RMT SETUP      1. Foundation Setup",
    "532 Bernard Ave, Kelowna, BC V1Y 6P1",
    "ROCKY MOUNTAIN TATTOO  [ LOCATIONS ]",
    "ROCKY MOUNTAIN TATTOO: master context doc",
    "AI tattoo studio website RMT",
    "RMT  PASSWORDS",
    "Rocky Mountain Tattoo Studio  AI Studio Website / AI Agentic Operation",
    "2025  ROCKY MOUNTAIN TATTOO",
    "Color codes RMT",
    "TATTOO AI OS      I will give you one instance of something that human",
    "Square - cash transfer - appointments   laser pack",
    "consent forms / boxes with labeling {year} + form holder pads  desktop",
    "SEO AND META    SEO Meta Descriptions Framework",
    "3 pillars   — APPRENTICE —   from their perspective:  A Day in the",
    "AGENT IDEAS ON WIX     \t 1\tAutomated Booking Qualification & Artist",
    "operational business plan",
    "CLIENT ACQUISITION  ENGINE    DATA LAYER (Foundation)",
    "BLOG IDEAS     Choosing studio: lower tier studio vs higher tier, explained",
    "COPYWRITING     {",
    "Strategist Mode — focus: Google Maps + indexing/AEO (AI-ready SEO",
    "UNIFIED CSV FORMAT   Collections (with fields)",
    "SITE STRUCTURE  * Website must cover transparency regarding:  * Pricing",
    "BRAND FOUNDATION",
    "Pre-launch CMS lint (final pass)",
    "TATTOO AI OS",
    "info@rockymountaintattoovancouver.com -   jewels@rockymountaintattoovancouver.com",
    "we will build a backend for a 4 location services business \" Rocky",
    "Uzdevumi    finish website polishing  square services   google business",
    "taski:    backpiece dizains pag. ned klientam  new apprentice curriculum",
    "ask - REVIEWS west side reception !!!!  marketing -    laser as pre",
    "ARTISTS ONBOARDING PDF",
    "setup artists booklet -> create tabs -> import the list from PT",
    "MIGRATION",
    "TASKS     google maps and business page",
    "CONTEXT   we are not in studio station rental business any more we",
    "Victor  Marketing and Marketing Strategy  Ziggy   Resident Artists",
]

output_dir = os.path.expanduser("~/Desktop/Alex Wiki/rocky-mountain-tattoo/notes")

def clean_filename(title):
    # Take first 60 chars, clean for filename
    clean = title[:80]
    clean = re.sub(r'[^\w\s-]', '', clean)
    clean = re.sub(r'\s+', '-', clean.strip())
    clean = clean.lower()
    clean = re.sub(r'-+', '-', clean)
    clean = clean.strip('-')
    if not clean:
        clean = "untitled"
    return clean[:80] + ".md"

print(f"Exporting {len(notes_to_export)} notes...")

# Write the list of note titles for the AppleScript to use
with open('/tmp/rmt_note_titles.txt', 'w') as f:
    for title in notes_to_export:
        fname = clean_filename(title)
        f.write(f"{title}\t{fname}\n")

print("Title list written to /tmp/rmt_note_titles.txt")
print(f"Output dir: {output_dir}")
