cc-safe-setup 29.6.5 → 29.6.6

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,51 @@
1
+ #!/bin/bash
2
+ # ================================================================
3
+ # daily-usage-tracker.sh — Track daily tool call count
4
+ # ================================================================
5
+ # PURPOSE:
6
+ # Records each tool call with a timestamp. At session end (or on
7
+ # demand), shows how many tool calls were made today vs yesterday.
8
+ # Helps detect abnormal usage patterns early.
9
+ #
10
+ # TRIGGER: PostToolUse
11
+ # MATCHER: (any — leave matcher empty)
12
+ #
13
+ # CONFIGURATION:
14
+ # CC_DAILY_WARN=500 (warn if daily count exceeds this, default: 500)
15
+ #
16
+ # Output: logs to ~/.claude/daily-usage/YYYY-MM-DD.log
17
+ # ================================================================
18
+
19
+ DAILY_DIR="${HOME}/.claude/daily-usage"
20
+ mkdir -p "$DAILY_DIR"
21
+
22
+ TODAY=$(date +%Y-%m-%d)
23
+ TODAY_FILE="${DAILY_DIR}/${TODAY}.log"
24
+ WARN_THRESHOLD="${CC_DAILY_WARN:-500}"
25
+
26
+ INPUT=$(cat)
27
+ TOOL=$(echo "$INPUT" | jq -r '.tool_name // "unknown"' 2>/dev/null)
28
+
29
+ # Record the call
30
+ echo "$(date +%H:%M:%S) $TOOL" >> "$TODAY_FILE"
31
+
32
+ # Count today's calls
33
+ TODAY_COUNT=$(wc -l < "$TODAY_FILE" 2>/dev/null || echo 0)
34
+
35
+ # Warn at milestones
36
+ case "$TODAY_COUNT" in
37
+ 100|250|500|1000)
38
+ echo "📊 Daily usage: $TODAY_COUNT tool calls today ($TODAY)" >&2
39
+ ;;
40
+ esac
41
+
42
+ # Warn if threshold exceeded
43
+ if [ "$TODAY_COUNT" -eq "$WARN_THRESHOLD" ]; then
44
+ YESTERDAY=$(date -d "yesterday" +%Y-%m-%d 2>/dev/null || date -v-1d +%Y-%m-%d 2>/dev/null)
45
+ YESTERDAY_FILE="${DAILY_DIR}/${YESTERDAY}.log"
46
+ YESTERDAY_COUNT=0
47
+ [ -f "$YESTERDAY_FILE" ] && YESTERDAY_COUNT=$(wc -l < "$YESTERDAY_FILE")
48
+ echo "⚠ Daily usage warning: $TODAY_COUNT calls today (yesterday: $YESTERDAY_COUNT)" >&2
49
+ fi
50
+
51
+ exit 0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cc-safe-setup",
3
- "version": "29.6.5",
4
- "description": "One command to make Claude Code safe. 415 example hooks + 8 built-in. 52 CLI commands. 5627 tests. Works with Auto Mode.",
3
+ "version": "29.6.6",
4
+ "description": "One command to make Claude Code safe. 416 example hooks + 8 built-in. 52 CLI commands. 5633 tests. Works with Auto Mode.",
5
5
  "main": "index.mjs",
6
6
  "bin": {
7
7
  "cc-safe-setup": "index.mjs"