claude-cac 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/cac +15 -15
- package/package.json +1 -1
package/cac
CHANGED
|
@@ -10,7 +10,7 @@ VERSIONS_DIR="$CAC_DIR/versions"
|
|
|
10
10
|
# ━━━ utils.sh ━━━
|
|
11
11
|
# ── utils: 颜色、读写、UUID、proxy 解析 ───────────────────────
|
|
12
12
|
|
|
13
|
-
CAC_VERSION="1.1.
|
|
13
|
+
CAC_VERSION="1.1.6"
|
|
14
14
|
|
|
15
15
|
_read() { [[ -f "$1" ]] && tr -d '[:space:]' < "$1" || echo "${2:-}"; }
|
|
16
16
|
_die() { printf '%b\n' "$(_red "error:") $*" >&2; exit 1; }
|
|
@@ -1195,20 +1195,20 @@ _ensure_initialized() {
|
|
|
1195
1195
|
mkdir -p "$CAC_DIR" "$ENVS_DIR" "$VERSIONS_DIR"
|
|
1196
1196
|
|
|
1197
1197
|
# Always sync JS hooks + dns-guard (they update with cac versions)
|
|
1198
|
-
#
|
|
1199
|
-
|
|
1200
|
-
#
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1198
|
+
# Find the real package directory — npm creates symlinks:
|
|
1199
|
+
# ~/.nvm/.../bin/cac → ../lib/node_modules/claude-cac/cac
|
|
1200
|
+
# relay.js and fingerprint-hook.js live alongside the real cac script
|
|
1201
|
+
local _self_dir=""
|
|
1202
|
+
local _cac_bin; _cac_bin="$(command -v cac 2>/dev/null || true)"
|
|
1203
|
+
if [[ -n "$_cac_bin" ]] && [[ -L "$_cac_bin" ]]; then
|
|
1204
|
+
local _link; _link="$(readlink "$_cac_bin")"
|
|
1205
|
+
[[ "$_link" != /* ]] && _link="$(dirname "$_cac_bin")/$_link"
|
|
1206
|
+
_self_dir="$(cd "$(dirname "$_link")" && pwd)"
|
|
1207
|
+
fi
|
|
1208
|
+
# Fallback: directory of the running script
|
|
1209
|
+
if [[ -z "$_self_dir" ]] || [[ ! -f "$_self_dir/relay.js" ]]; then
|
|
1210
|
+
_self_dir="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
1211
|
+
fi
|
|
1212
1212
|
[[ -f "$_self_dir/fingerprint-hook.js" ]] && cp "$_self_dir/fingerprint-hook.js" "$CAC_DIR/fingerprint-hook.js"
|
|
1213
1213
|
[[ -f "$_self_dir/relay.js" ]] && cp "$_self_dir/relay.js" "$CAC_DIR/relay.js"
|
|
1214
1214
|
_write_dns_guard_js 2>/dev/null || true
|