claude-cac 1.5.2-beta.2 → 1.5.3
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/cac +23 -21
- package/package.json +1 -1
package/cac
CHANGED
|
@@ -11,7 +11,7 @@ VERSIONS_DIR="$CAC_DIR/versions"
|
|
|
11
11
|
# ── utils: colors, read/write, UUID, proxy parsing ───────────────────────
|
|
12
12
|
|
|
13
13
|
# shellcheck disable=SC2034 # used in build-concatenated cac script
|
|
14
|
-
CAC_VERSION="1.5.
|
|
14
|
+
CAC_VERSION="1.5.3"
|
|
15
15
|
|
|
16
16
|
_read() { [[ -f "$1" ]] && tr -d '[:space:]' < "$1" || echo "${2:-}"; }
|
|
17
17
|
_die() { printf '%b\n' "$(_red "error:") $*" >&2; exit 1; }
|
|
@@ -1589,9 +1589,18 @@ _ensure_initialized() {
|
|
|
1589
1589
|
echo "[cac] warning: running as root may corrupt ~/.cac/ file ownership" >&2
|
|
1590
1590
|
echo "[cac] hint: run as your normal user instead" >&2
|
|
1591
1591
|
fi
|
|
1592
|
-
|
|
1593
|
-
[[ -f "$_self_dir/
|
|
1592
|
+
# rm -f first: user owns ~/.cac/ dir so can delete root-owned files even if can't overwrite them
|
|
1593
|
+
if [[ -f "$_self_dir/fingerprint-hook.js" ]]; then
|
|
1594
|
+
rm -f "$CAC_DIR/fingerprint-hook.js" 2>/dev/null || true
|
|
1595
|
+
cp "$_self_dir/fingerprint-hook.js" "$CAC_DIR/fingerprint-hook.js" 2>/dev/null || true
|
|
1596
|
+
fi
|
|
1597
|
+
if [[ -f "$_self_dir/relay.js" ]]; then
|
|
1598
|
+
rm -f "$CAC_DIR/relay.js" 2>/dev/null || true
|
|
1599
|
+
cp "$_self_dir/relay.js" "$CAC_DIR/relay.js" 2>/dev/null || true
|
|
1600
|
+
fi
|
|
1601
|
+
rm -f "$CAC_DIR/cac-dns-guard.js" 2>/dev/null || true
|
|
1594
1602
|
_write_dns_guard_js 2>/dev/null || true
|
|
1603
|
+
rm -f "$CAC_DIR/blocked_hosts" 2>/dev/null || true
|
|
1595
1604
|
_write_blocked_hosts 2>/dev/null || true
|
|
1596
1605
|
|
|
1597
1606
|
# PATH (idempotent — always ensure it's in rc file)
|
|
@@ -1738,7 +1747,7 @@ _env_cmd_create() {
|
|
|
1738
1747
|
mkdir -p "$env_dir"
|
|
1739
1748
|
[[ -n "$proxy_url" ]] && echo "$proxy_url" > "$env_dir/proxy"
|
|
1740
1749
|
echo "$(_new_uuid)" > "$env_dir/uuid"
|
|
1741
|
-
|
|
1750
|
+
touch "$env_dir/user_id"
|
|
1742
1751
|
echo "$(_new_machine_id)" > "$env_dir/machine_id"
|
|
1743
1752
|
echo "$(_new_hostname)" > "$env_dir/hostname"
|
|
1744
1753
|
echo "$(_new_mac)" > "$env_dir/mac_address"
|
|
@@ -1831,7 +1840,6 @@ MERGE_EOF
|
|
|
1831
1840
|
if [[ -d "$env_dir/.claude" ]]; then
|
|
1832
1841
|
export CLAUDE_CONFIG_DIR="$env_dir/.claude"
|
|
1833
1842
|
fi
|
|
1834
|
-
_update_claude_json_user_id "$(_read "$env_dir/user_id")" 2>/dev/null || true
|
|
1835
1843
|
|
|
1836
1844
|
local elapsed; elapsed=$(_timer_elapsed)
|
|
1837
1845
|
echo
|
|
@@ -1927,7 +1935,6 @@ _env_cmd_activate() {
|
|
|
1927
1935
|
export CLAUDE_CONFIG_DIR="$ENVS_DIR/$name/.claude"
|
|
1928
1936
|
fi
|
|
1929
1937
|
|
|
1930
|
-
_update_claude_json_user_id "$(_read "$ENVS_DIR/$name/user_id")"
|
|
1931
1938
|
|
|
1932
1939
|
# Relay lifecycle
|
|
1933
1940
|
_relay_stop 2>/dev/null || true
|
|
@@ -2437,23 +2444,18 @@ cmd_check() {
|
|
|
2437
2444
|
else
|
|
2438
2445
|
_id_issues+=("repo hash not spoofed")
|
|
2439
2446
|
fi
|
|
2440
|
-
# user_id
|
|
2447
|
+
# user_id tracking: sync from .claude.json after login (real userID wins)
|
|
2441
2448
|
local _uid_ok=true
|
|
2442
|
-
local
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
_actual_uid=$(python3 -c "import json,sys; print(json.load(open(sys.argv[1])).get('userID',''))" "$_cj" 2>/dev/null || true)
|
|
2449
|
+
local _config_dir="${CLAUDE_CONFIG_DIR:-$ENVS_DIR/$current/.claude}"
|
|
2450
|
+
local _cj="$_config_dir/.claude.json"
|
|
2451
|
+
[[ -f "$_cj" ]] || _cj="$HOME/.claude.json"
|
|
2452
|
+
if [[ -f "$_cj" ]]; then
|
|
2453
|
+
local _actual_uid
|
|
2454
|
+
_actual_uid=$(python3 -c "import json,sys; print(json.load(open(sys.argv[1])).get('userID',''))" "$_cj" 2>/dev/null || true)
|
|
2455
|
+
if [[ -n "$_actual_uid" ]]; then
|
|
2450
2456
|
(( _id_total++ )) || true
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
_id_issues+=("user_id mismatch")
|
|
2454
|
-
else
|
|
2455
|
-
(( _id_ok++ )) || true
|
|
2456
|
-
fi
|
|
2457
|
+
echo "$_actual_uid" > "$env_dir/user_id" 2>/dev/null || true
|
|
2458
|
+
(( _id_ok++ )) || true
|
|
2457
2459
|
fi
|
|
2458
2460
|
fi
|
|
2459
2461
|
# billing header
|