Implementation Plan: InBox → Gantt Nightly Sync
Source of Truth
- Spec:
.omx/specs/deep-interview-scheduled-task-git-sync-gant.md
- Context:
.omx/context/scheduled-task-git-sync-gant-20260429T161523Z.md
Architecture
Files to Create
| File |
Path |
Purpose |
| Sync script |
C:\Users\Zane\Desktop\Gantt App\sync-inbox-to-gantt.ps1 |
Main nightly script |
| Setup script |
C:\app\unity_project\obsidian-notes\.omx\setup-task.ps1 |
One-shot Task Scheduler registration |
Algorithm
Phase A — Git Sync
cd C:\app\unity_project\obsidian-notes
git pull — if conflict → git merge --abort → exit git phase
git add PARA/ InBox/
git diff --cached --quiet → if no changes, skip commit
git commit -m "auto nightly sync"
git push — if failure → Show-Toast "Git push failed" → continue
Phase B — Gantt Mirror
- Call
gantt-app.exe --cli list-tasks → parse JSON
- If Gantt not running (process error / non-zero exit) → skip phase B
- Extract
"待看:*" tasks → set {baseName} from task name
- Scan
InBox\*.md → set {baseName} from filename (strip .md)
- Add: For each InBox file NOT in Gantt →
add-task --name "待看:{baseName}" --start {today} --end "" --progress 0
- Delete: For each Gantt "待看:*" NOT in InBox →
delete-task --id {id}
- Existing matches: No-op (already correct)
Error Handling Matrix
| Failure |
Behavior |
| Git pull conflict |
git merge --abort, skip rest of git phase |
| Git push fails |
PowerShell toast notification, continue to Gantt phase |
| Gantt CLI not found |
Write-Error, exit 1 |
| Gantt not running |
Skip Gantt phase silently |
| Gantt add/delete fails |
Write-Error for that item, continue |
| Script not in gantt dir |
Resolve gantt dir from script location dynamically |
Task Scheduler Registration
Implementation Tasks
- Create sync-inbox-to-gantt.ps1 — the main sync script with all logic
- Create setup-task.ps1 — registers the scheduled task
- Manual dry-run test — run script manually, verify Gantt tasks created