claude-cac 1.1.3 → 1.1.5

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.
Files changed (2) hide show
  1. package/cac +14 -2
  2. 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.3"
13
+ CAC_VERSION="1.1.5"
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,8 +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
+ # Resolve symlink — npm global install creates: .nvm/.../bin/cac → ../lib/node_modules/claude-cac/cac
1199
+ local _self_path="${BASH_SOURCE[0]:-$0}"
1200
+ # $0 may be just "cac" (no path) when invoked via PATH — resolve it
1201
+ if [[ "$_self_path" != /* ]]; then
1202
+ _self_path="$(command -v "$_self_path" 2>/dev/null || which "$_self_path" 2>/dev/null || echo "$_self_path")"
1203
+ fi
1204
+ # Follow symlink to real package directory
1205
+ if [[ -L "$_self_path" ]]; then
1206
+ local _link; _link="$(readlink "$_self_path")"
1207
+ [[ "$_link" != /* ]] && _link="$(dirname "$_self_path")/$_link"
1208
+ _self_path="$_link"
1209
+ fi
1198
1210
  local _self_dir
1199
- _self_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1211
+ _self_dir="$(cd "$(dirname "$_self_path")" && pwd)"
1200
1212
  [[ -f "$_self_dir/fingerprint-hook.js" ]] && cp "$_self_dir/fingerprint-hook.js" "$CAC_DIR/fingerprint-hook.js"
1201
1213
  [[ -f "$_self_dir/relay.js" ]] && cp "$_self_dir/relay.js" "$CAC_DIR/relay.js"
1202
1214
  _write_dns_guard_js 2>/dev/null || true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-cac",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Isolate, protect, and manage your Claude Code — versions, environments, identity, and proxy.",
5
5
  "bin": {
6
6
  "cac": "cac"