cc-safe-setup 29.6.30 → 29.6.31

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.
@@ -0,0 +1,39 @@
1
+ #!/bin/bash
2
+ # pre-compact-checkpoint.sh — Auto-save before context compaction
3
+ #
4
+ # Uses the PreCompact hook event to create a git checkpoint before
5
+ # Claude Code compresses the conversation context. This ensures
6
+ # uncommitted edits are preserved even if compaction loses track
7
+ # of recent changes.
8
+ #
9
+ # Solves: Context compaction can cause Claude to lose awareness of
10
+ # recent file edits (#34674). A pre-compaction checkpoint
11
+ # makes recovery trivial: just run `git log --oneline -5`.
12
+ #
13
+ # TRIGGER: PreCompact (fires right before context compression)
14
+ # MATCHER: No matcher support — always fires
15
+ #
16
+ # DECISION CONTROL: None (notification only)
17
+ #
18
+ # Compared to auto-compact-prep.sh (which uses tool call counting
19
+ # on PreToolUse), this hook fires at the exact right moment —
20
+ # when compaction actually happens, not on an estimated threshold.
21
+
22
+ # Check if we're in a git repo
23
+ git rev-parse --is-inside-work-tree &>/dev/null || exit 0
24
+
25
+ # Check for uncommitted changes
26
+ CHANGES=$(git status --porcelain 2>/dev/null | wc -l)
27
+ [ "$CHANGES" -eq 0 ] && exit 0
28
+
29
+ # Create checkpoint commit
30
+ BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
31
+ TIMESTAMP=$(date -u '+%Y%m%d-%H%M%S')
32
+
33
+ git add -A 2>/dev/null
34
+ git commit -m "checkpoint: pre-compact auto-save (${CHANGES} files, ${TIMESTAMP})" --no-verify 2>/dev/null
35
+
36
+ echo "📸 Pre-compact checkpoint: ${CHANGES} file(s) saved on ${BRANCH}" >&2
37
+ echo " Recover with: git log --oneline -5" >&2
38
+
39
+ exit 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "29.6.30",
4
- "description": "One command to make Claude Code safe. 516 example hooks + 8 built-in. 56 CLI commands. 7582 tests. Works with Auto Mode.",
3
+ "version": "29.6.31",
4
+ "description": "One command to make Claude Code safe. 517 example hooks + 8 built-in. 56 CLI commands. 7591 tests. Works with Auto Mode.",
5
5
  "main": "index.mjs",
6
6
  "bin": {
7
7
  "cc-safe-setup": "index.mjs"