-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·55 lines (42 loc) · 1.46 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·55 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# cc-tempo installer
# Copies the statusline scripts into ~/.claude/ and installs the
# claude-context-percentage CLI globally via npm.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CLAUDE_DIR="${CLAUDE_HOME:-$HOME/.claude}"
info() { printf '==> %s\n' "$*"; }
fail() { printf 'error: %s\n' "$*" >&2; exit 1; }
info "Checking dependencies"
missing=()
for cmd in jq bc python3 node npm git; do
command -v "$cmd" >/dev/null 2>&1 || missing+=("$cmd")
done
if (( ${#missing[@]} > 0 )); then
fail "missing: ${missing[*]} — on macOS try: brew install jq bc node git"
fi
info "Installing scripts to $CLAUDE_DIR"
mkdir -p "$CLAUDE_DIR"
install -m 0755 "$SCRIPT_DIR/bin/statusline.sh" "$CLAUDE_DIR/statusline.sh"
install -m 0755 "$SCRIPT_DIR/bin/calc_active_time.py" "$CLAUDE_DIR/calc_active_time.py"
info "Building and linking claude-context-percentage CLI"
(
cd "$SCRIPT_DIR/tools/context-percentage"
npm install
npm run build
npm install -g .
)
cat <<EOF
Done.
Add the following to ~/.claude/settings.json (merge with any existing keys):
{
"statusLine": {
"type": "command",
"command": "bash $CLAUDE_DIR/statusline.sh"
}
}
Or merge automatically with jq:
jq '.statusLine = {"type":"command","command":"bash $CLAUDE_DIR/statusline.sh"}' \\
~/.claude/settings.json > /tmp/settings.json && mv /tmp/settings.json ~/.claude/settings.json
Restart Claude Code to activate the status line.
EOF