name: mac-sync
description: Unified macOS sync agent — iMessage, Photos, Mail, Calendar (2-way), Reminders (2-way), Notes (2-way via AppleScript), Calls (read-only)
type: application
category: sync
version: 0.2.0
modules:
  - imessage    # bidirectional via SendQueueClient over legacy send_queue table
  - iphoto      # read-only Mac → server
  - imail       # bidirectional via AppleScript
  - ical        # bidirectional via SendQueueClient
  - ireminders  # bidirectional via SendQueueClient
  - inotes      # bidirectional via AppleScript
  - icalls      # read-only Mac → server (Apple CallHistory.storedata)

platforms:
  plum:
    os: macos
    # plum (fennel) roams — no fixed LAN IP; reach over wg mesh. `ssh plum`
    # (ssh-config alias) is the canonical handle the scripts below use.
    host: 10.9.0.3
    environment: production
    services:
      client:
        type: launchagent
        bundle_id: com.lilith.mac-sync
        description: MacSync menu bar agent (Messages + Photos + Mail + Calendar + Reminders + Notes sync)
    start:
      path: ~/Code/@ct/@applications/macsync
      script: deploy/deploy-remote.sh
    stop:
      path: ~/Code/@ct/@applications/macsync
      script: |
        ssh plum "launchctl unload ~/Library/LaunchAgents/com.lilith.mac-sync.plist 2>/dev/null || true"
    status:
      command: "ssh plum 'pgrep -x MacSyncApp > /dev/null && echo ok || echo stopped'"
      type: process
    logs:
      command: "ssh plum 'tail -f ~/Library/Application\\ Support/MacSync/stderr.log'"

  # DO backend droplet (lilith-store-backend) — replaces dead homelan `black`.
  # public 165.227.96.183 · wg 10.9.0.5 · VPC 10.20.0.2. See uvlava plan
  # (~/.claude/plans/nested-jingling-truffle.md, replacement item #8).
  backend-droplet:
    os: linux
    host: 165.227.96.183
    environment: production
    services:
      server:
        type: systemd
        unit: mac-sync-server
        port: "3201"
        description: Mac sync ingestion + query server (Bun/Hono)
    start:
      path: ~/Code/@ct/@applications/macsync
      script: deploy/deploy-server.sh
    stop:
      path: ~/Code/@ct/@applications/macsync
      script: "ssh 165.227.96.183 'sudo systemctl stop mac-sync-server'"
    status:
      command: "ssh 165.227.96.183 'curl -sf http://localhost:3201/health > /dev/null && echo ok'"
      type: http
    logs:
      command: "ssh 165.227.96.183 'tail -f /var/log/mac-sync-server.log'"
