cc-safe-setup 11.0.0 → 11.1.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.
@@ -0,0 +1,36 @@
1
+ #!/bin/bash
2
+ # ================================================================
3
+ # max-session-duration.sh — Warn when session exceeds time limit
4
+ # ================================================================
5
+ # PURPOSE:
6
+ # Long autonomous sessions can rack up costs and context issues.
7
+ # This hook tracks session duration and warns when it exceeds
8
+ # a configurable limit, suggesting a new session.
9
+ #
10
+ # TRIGGER: PostToolUse MATCHER: ""
11
+ #
12
+ # CONFIG:
13
+ # CC_MAX_SESSION_HOURS=4 (warn after 4 hours)
14
+ # ================================================================
15
+
16
+ MAX_HOURS="${CC_MAX_SESSION_HOURS:-4}"
17
+ STATE="/tmp/cc-session-start-$(echo "$PWD" | md5sum | cut -c1-8)"
18
+
19
+ NOW=$(date +%s)
20
+
21
+ if [ ! -f "$STATE" ]; then
22
+ echo "$NOW" > "$STATE"
23
+ exit 0
24
+ fi
25
+
26
+ START=$(cat "$STATE" 2>/dev/null || echo "$NOW")
27
+ ELAPSED=$(( (NOW - START) / 3600 ))
28
+
29
+ if [ "$ELAPSED" -ge "$MAX_HOURS" ]; then
30
+ MINS=$(( (NOW - START) / 60 ))
31
+ echo "WARNING: Session running for ${ELAPSED}h ${MINS}m." >&2
32
+ echo "Consider starting a new session to reset context." >&2
33
+ echo "Reset timer: rm $STATE" >&2
34
+ fi
35
+
36
+ exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "11.0.0",
3
+ "version": "11.1.0",
4
4
  "description": "One command to make Claude Code safe. 59 hooks (8 built-in + 51 examples). 26 CLI commands: dashboard, create, audit, lint, diff, migrate, compare, generate-ci. 284 tests.",
5
5
  "main": "index.mjs",
6
6
  "bin": {