claude-code-tracker 1.1.5 → 1.1.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.
- package/README.md +3 -0
- package/install.sh +24 -24
- package/package.json +1 -1
- package/uninstall.sh +16 -7
package/README.md
CHANGED
|
@@ -35,8 +35,11 @@ Homebrew only knows about packages in its default registry. `brew tap` adds a th
|
|
|
35
35
|
```bash
|
|
36
36
|
brew tap kelsi-andrewss/claude-code-tracker
|
|
37
37
|
brew install claude-code-tracker
|
|
38
|
+
claude-tracker-setup
|
|
38
39
|
```
|
|
39
40
|
|
|
41
|
+
The `claude-tracker-setup` command registers the Stop hook in `~/.claude/settings.json`. This must be run separately because Homebrew's install sandbox blocks writes to user directories.
|
|
42
|
+
|
|
40
43
|
### Option 3 — git clone
|
|
41
44
|
|
|
42
45
|
```bash
|
package/install.sh
CHANGED
|
@@ -7,31 +7,29 @@ SETTINGS="$HOME/.claude/settings.json"
|
|
|
7
7
|
|
|
8
8
|
echo "Installing claude-code-tracker..."
|
|
9
9
|
|
|
10
|
-
# Install scripts
|
|
11
|
-
mkdir -p "$INSTALL_DIR"
|
|
12
|
-
|
|
13
10
|
# Detect Homebrew install (SCRIPT_DIR is inside a Cellar path)
|
|
14
11
|
if [[ "$SCRIPT_DIR" == */Cellar/* ]]; then
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
# Resolve stable opt path — survives brew upgrade (Homebrew maintains the symlink)
|
|
13
|
+
FORMULA_NAME="$(echo "$SCRIPT_DIR" | sed -n 's|.*/Cellar/\([^/]*\)/.*|\1|p')"
|
|
14
|
+
OPT_PREFIX="$(brew --prefix "$FORMULA_NAME" 2>/dev/null)" || OPT_PREFIX=""
|
|
15
|
+
if [[ -z "$OPT_PREFIX" ]]; then
|
|
16
|
+
echo "Error: could not resolve brew --prefix for $FORMULA_NAME" >&2
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
HOOK_CMD="$OPT_PREFIX/libexec/src/stop-hook.sh"
|
|
20
|
+
echo "Homebrew install detected — hook will point to $HOOK_CMD"
|
|
24
21
|
else
|
|
25
22
|
# Direct copy for npm / git-clone installs
|
|
23
|
+
mkdir -p "$INSTALL_DIR"
|
|
26
24
|
rm -f "$INSTALL_DIR/"*.sh "$INSTALL_DIR/"*.py 2>/dev/null || true
|
|
27
25
|
cp "$SCRIPT_DIR/src/"*.sh "$SCRIPT_DIR/src/"*.py "$INSTALL_DIR/"
|
|
28
26
|
chmod +x "$INSTALL_DIR/"*.sh "$INSTALL_DIR/"*.py
|
|
27
|
+
HOOK_CMD="$INSTALL_DIR/stop-hook.sh"
|
|
28
|
+
echo "Scripts installed to $INSTALL_DIR"
|
|
29
29
|
fi
|
|
30
30
|
|
|
31
|
-
echo "Scripts installed to $INSTALL_DIR"
|
|
32
|
-
|
|
33
31
|
# Patch settings.json — add Stop hook if not already present
|
|
34
|
-
python3 - "$SETTINGS" "$
|
|
32
|
+
python3 - "$SETTINGS" "$HOOK_CMD" <<'PYEOF'
|
|
35
33
|
import sys, json, os
|
|
36
34
|
|
|
37
35
|
settings_file = sys.argv[1]
|
|
@@ -77,15 +75,17 @@ MDEOF
|
|
|
77
75
|
echo "Tracking instruction added to $CLAUDE_MD"
|
|
78
76
|
fi
|
|
79
77
|
|
|
80
|
-
# Backfill historical sessions for the current project
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
[[
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
# Backfill historical sessions for the current project (skip for Homebrew installs)
|
|
79
|
+
if [[ "$SCRIPT_DIR" != */Cellar/* ]]; then
|
|
80
|
+
PROJECT_ROOT="$PWD"
|
|
81
|
+
while [[ "$PROJECT_ROOT" != "/" ]]; do
|
|
82
|
+
[[ -d "$PROJECT_ROOT/.git" ]] && break
|
|
83
|
+
PROJECT_ROOT="$(dirname "$PROJECT_ROOT")"
|
|
84
|
+
done
|
|
85
|
+
if [[ "$PROJECT_ROOT" != "/" ]]; then
|
|
86
|
+
echo "Backfilling historical sessions..."
|
|
87
|
+
python3 "$INSTALL_DIR/backfill.py" "$PROJECT_ROOT"
|
|
88
|
+
fi
|
|
89
89
|
fi
|
|
90
90
|
|
|
91
91
|
echo "claude-code-tracker installed. Restart Claude Code to activate."
|
package/package.json
CHANGED
package/uninstall.sh
CHANGED
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
4
5
|
INSTALL_DIR="$HOME/.claude/tracking"
|
|
5
6
|
SETTINGS="$HOME/.claude/settings.json"
|
|
6
|
-
HOOK_CMD="$INSTALL_DIR/stop-hook.sh"
|
|
7
7
|
|
|
8
8
|
echo "Uninstalling claude-code-tracker..."
|
|
9
9
|
|
|
10
|
-
#
|
|
11
|
-
if [[
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
# Detect Homebrew install
|
|
11
|
+
if [[ "$SCRIPT_DIR" == */Cellar/* ]]; then
|
|
12
|
+
FORMULA_NAME="$(echo "$SCRIPT_DIR" | sed -n 's|.*/Cellar/\([^/]*\)/.*|\1|p')"
|
|
13
|
+
OPT_PREFIX="$(brew --prefix "$FORMULA_NAME" 2>/dev/null)" || OPT_PREFIX=""
|
|
14
|
+
HOOK_CMD="${OPT_PREFIX:+$OPT_PREFIX/libexec/src/stop-hook.sh}"
|
|
15
|
+
echo "Homebrew install detected — skipping script removal from $INSTALL_DIR"
|
|
14
16
|
else
|
|
15
|
-
|
|
17
|
+
HOOK_CMD="$INSTALL_DIR/stop-hook.sh"
|
|
18
|
+
# Remove scripts
|
|
19
|
+
if [[ -d "$INSTALL_DIR" ]]; then
|
|
20
|
+
rm -f "$INSTALL_DIR/"*.sh "$INSTALL_DIR/"*.py
|
|
21
|
+
echo "Scripts removed from $INSTALL_DIR"
|
|
22
|
+
else
|
|
23
|
+
echo "Nothing to remove at $INSTALL_DIR"
|
|
24
|
+
fi
|
|
16
25
|
fi
|
|
17
26
|
|
|
18
27
|
# Remove hook entry from settings.json
|
|
19
|
-
if [[ -f "$SETTINGS" ]]; then
|
|
28
|
+
if [[ -f "$SETTINGS" ]] && [[ -n "$HOOK_CMD" ]]; then
|
|
20
29
|
python3 - "$SETTINGS" "$HOOK_CMD" <<'PYEOF'
|
|
21
30
|
import sys, json, os
|
|
22
31
|
|