sync: add Phase 0 uncommitted session log check
Before invoking sync.sh, /sync now scans for untracked or modified session log files across session-logs/, clients/*/session-logs/, and projects/*/session-logs/. If any are found, it warns the user and offers to run /save instead so logs get a proper narrative commit rather than a generic "sync: auto-sync" message. Escalation behavior: default toward /save; user can override to proceed with plain sync if they explicitly choose. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,42 @@
|
|||||||
Sync the ClaudeTools and vault repos with Gitea.
|
Sync the ClaudeTools and vault repos with Gitea.
|
||||||
|
|
||||||
|
## Phase 0 — Uncommitted Session Log Check
|
||||||
|
|
||||||
|
**Run this before invoking `sync.sh`.**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git status --porcelain | grep -E '\bsession-logs/.*\.md$' | grep -v '^\s*D '
|
||||||
|
```
|
||||||
|
|
||||||
|
This finds any untracked (`??`) or modified (` M`, `M `, `AM`) session log files across all locations:
|
||||||
|
- `session-logs/*.md` (root general logs)
|
||||||
|
- `clients/*/session-logs/*.md`
|
||||||
|
- `projects/*/session-logs/*.md`
|
||||||
|
|
||||||
|
**If count == 0:** proceed with sync normally (invoke `sync.sh`).
|
||||||
|
|
||||||
|
**If count > 0:**
|
||||||
|
|
||||||
|
Emit:
|
||||||
|
```
|
||||||
|
[WARNING] Found <N> uncommitted session log(s):
|
||||||
|
- <path/to/file.md>
|
||||||
|
- ...
|
||||||
|
|
||||||
|
These contain work context that will be auto-committed with a generic
|
||||||
|
"sync: auto-sync" message if you proceed. Run /save instead to capture
|
||||||
|
a proper narrative summary before syncing.
|
||||||
|
```
|
||||||
|
|
||||||
|
Then ask: "Run /save now, or proceed with plain sync anyway?"
|
||||||
|
|
||||||
|
- If user says **save** (or doesn't respond / says yes): execute the full `/save` flow (write session log → `sync.sh`). Do NOT call `sync.sh` separately after — `/save` already calls it.
|
||||||
|
- If user says **proceed / skip**: invoke `sync.sh` directly and note that the session logs will be auto-committed with generic messages.
|
||||||
|
|
||||||
|
The intent: a `/sync` that finds unsaved work should default toward `/save`. Auto-committing session logs with "sync: auto-sync" loses the narrative context that makes logs searchable.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## What this does
|
## What this does
|
||||||
|
|
||||||
Invokes `bash .claude/scripts/sync.sh`, which:
|
Invokes `bash .claude/scripts/sync.sh`, which:
|
||||||
|
|||||||
Reference in New Issue
Block a user