37 lines
1.0 KiB
PowerShell
37 lines
1.0 KiB
PowerShell
#!/usr/bin/env powershell
|
|
# sync-obsidian.ps1 - Syncs OpenClaw config and memory to Obsidian
|
|
# Runs via cron daily
|
|
|
|
$date = Get-Date -Format "yyyy-MM-dd"
|
|
$vaultPath = "C:\Users\admin\Documents\Corey\OpenClaw"
|
|
$workspacePath = "C:\Users\admin\.openclaw\workspace"
|
|
|
|
# Ensure directory exists
|
|
if (!(Test-Path $vaultPath)) {
|
|
New-Item -ItemType Directory -Path $vaultPath -Force | Out-Null
|
|
}
|
|
|
|
# Copy TOOLS.md to Obsidian (Discord config section is there)
|
|
Copy-Item "$workspacePath\TOOLS.md" "$vaultPath\Tools Reference.md" -Force
|
|
|
|
# Copy MEMORY.md
|
|
Copy-Item "$workspacePath\MEMORY.md" "$vaultPath\MEMORY Index.md" -Force -ErrorAction SilentlyContinue
|
|
|
|
# Create daily sync note
|
|
$syncContent = @"
|
|
# OpenClaw Sync - $date
|
|
|
|
## Files Synced
|
|
- Tools Reference.md (from TOOLS.md)
|
|
- MEMORY Index.md (from MEMORY.md)
|
|
|
|
## Notes
|
|
Last updated: $((Get-Date).ToString('HH:mm'))
|
|
|
|
---
|
|
"@
|
|
|
|
$syncContent | Out-File -FilePath "$vaultPath\Sync History $date.md" -Encoding utf8
|
|
|
|
Write-Host "Obsidian sync completed at $((Get-Date).ToString('yyyy-MM-dd HH:mm:ss'))"
|