# sync-cowork-memory.ps1
$memorySource = "C:\Users\olivi\AppData\Roaming\Claude\local-agent-mode-sessions\cad3a9c0-cf8e-4204-ac6e-e22c03811abe\7707aa40-4613-41ca-918f-a32d6df19bce\spaces"
$memoryDest   = "C:\dev\crowdlending-app\.cowork\memory"
$repoPath     = "C:\dev\crowdlending-app"

# Sync des fichiers mémoire
robocopy $memorySource $memoryDest *.md /E /XO /NFL /NDL

# Commit Git si des changements existent
Set-Location $repoPath
$status = git status --porcelain .cowork
if ($status) {
    git add .cowork
    git commit -m "chore: sync cowork memory $(Get-Date -Format 'yyyy-MM-dd HH:mm')"
    Write-Host "Mémoire Cowork synchronisée et commitée." -ForegroundColor Green
} else {
    Write-Host "Aucun changement détecté." -ForegroundColor Gray
}