codewhale.history 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/snapshot/SKILL.md +7 -2
package/package.json
CHANGED
package/skills/snapshot/SKILL.md
CHANGED
|
@@ -17,9 +17,12 @@ When the user types `//snapshot on`, `//snapshot off`, or `//snapshot status`, m
|
|
|
17
17
|
- **Windows**: `if (Test-Path .git) { ... }`
|
|
18
18
|
- **macOS/Linux**: `if [ -d .git ]; then ...`
|
|
19
19
|
3. **If Git repo exists**: reply "This workspace has a Git repo — snapshotting is not needed. Use `git restore <file>` to undo changes."
|
|
20
|
-
4. **If no Git repo**: create `_snapshots/` directory, write a note to persist `snapshot_enabled=true
|
|
20
|
+
4. **If no Git repo**: create `_snapshots/` directory, write a note to persist `snapshot_enabled=true` **and overwrite any stale naming-convention notes** with the timestamp format (this fixes sessions that cached old `v1/v2/v3` notes from a previous session start). Then confirm to the user.
|
|
21
21
|
5. From this point forward, before editing any **existing** file:
|
|
22
|
-
-
|
|
22
|
+
- **Ensure `_snapshots/` exists** — create it if missing (don't assume it still exists from init time)
|
|
23
|
+
**Windows**: `if (-not (Test-Path '_snapshots')) { New-Item -ItemType Directory -Path '_snapshots' -Force | Out-Null }`
|
|
24
|
+
**macOS/Linux**: `mkdir -p _snapshots`
|
|
25
|
+
- **Snapshot the file** using the appropriate command for the detected platform:
|
|
23
26
|
**Windows (PowerShell):**
|
|
24
27
|
```powershell
|
|
25
28
|
$ts = Get-Date -Format 'yyyy-MM-dd_HH-mm-ss'
|
|
@@ -34,6 +37,8 @@ When the user types `//snapshot on`, `//snapshot off`, or `//snapshot status`, m
|
|
|
34
37
|
ext=$(echo "<file>" | sed 's/.*\.//')
|
|
35
38
|
cp "<file>" "_snapshots/${base}.${ts}.${ext}"
|
|
36
39
|
```
|
|
40
|
+
- **Retry on failure**: if the copy command fails (non-zero exit), recreate `_snapshots/` and retry exactly once.
|
|
41
|
+
- **Final failure**: if the retry also fails, report the error to the user and **do NOT proceed with the edit** — this is a snapshot contract violation.
|
|
37
42
|
- Result example: `foo.py` → `_snapshots/foo.2026-06-20_11-30-00.py`
|
|
38
43
|
- Do NOT snapshot brand-new files being created for the first time
|
|
39
44
|
|