claude-cac 1.1.2 → 1.1.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.
Files changed (2) hide show
  1. package/cac +12 -16
  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.2"
13
+ CAC_VERSION="1.1.3"
14
14
 
15
15
  _read() { [[ -f "$1" ]] && tr -d '[:space:]' < "$1" || echo "${2:-}"; }
16
16
  _die() { printf '%b\n' "$(_red "error:") $*" >&2; exit 1; }
@@ -1192,22 +1192,28 @@ IFCONFIG_EOF
1192
1192
 
1193
1193
  # Silent, idempotent initialization — called automatically by any command
1194
1194
  _ensure_initialized() {
1195
- # Already initialized?
1196
- [[ -f "$CAC_DIR/bin/claude" ]] && [[ -d "$ENVS_DIR" ]] && [[ -d "$VERSIONS_DIR" ]] && return 0
1195
+ mkdir -p "$CAC_DIR" "$ENVS_DIR" "$VERSIONS_DIR"
1197
1196
 
1198
- mkdir -p "$ENVS_DIR" "$VERSIONS_DIR"
1197
+ # Always sync JS hooks + dns-guard (they update with cac versions)
1198
+ local _self_dir
1199
+ _self_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1200
+ [[ -f "$_self_dir/fingerprint-hook.js" ]] && cp "$_self_dir/fingerprint-hook.js" "$CAC_DIR/fingerprint-hook.js"
1201
+ [[ -f "$_self_dir/relay.js" ]] && cp "$_self_dir/relay.js" "$CAC_DIR/relay.js"
1202
+ _write_dns_guard_js 2>/dev/null || true
1203
+ _write_blocked_hosts 2>/dev/null || true
1204
+
1205
+ # Rest only needed on first init
1206
+ [[ -f "$CAC_DIR/bin/claude" ]] && return 0
1199
1207
 
1200
1208
  # Find real claude (system-installed or managed)
1201
1209
  local real_claude
1202
1210
  real_claude=$(_find_real_claude)
1203
1211
  if [[ -z "$real_claude" ]]; then
1204
- # Check managed versions
1205
1212
  local latest_ver; latest_ver=$(_read "$VERSIONS_DIR/.latest" "")
1206
1213
  if [[ -n "$latest_ver" ]]; then
1207
1214
  real_claude="$VERSIONS_DIR/$latest_ver/claude"
1208
1215
  fi
1209
1216
  fi
1210
- # If still not found, we can still initialize — env create will handle it
1211
1217
  if [[ -n "$real_claude" ]] && [[ -x "$real_claude" ]]; then
1212
1218
  echo "$real_claude" > "$CAC_DIR/real_claude"
1213
1219
  fi
@@ -1215,12 +1221,6 @@ _ensure_initialized() {
1215
1221
  local os; os=$(_detect_os)
1216
1222
  _write_wrapper
1217
1223
 
1218
- # Copy JS hooks from source location (build.sh puts them alongside cac)
1219
- local _self_dir
1220
- _self_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1221
- [[ -f "$_self_dir/fingerprint-hook.js" ]] && cp "$_self_dir/fingerprint-hook.js" "$CAC_DIR/fingerprint-hook.js"
1222
- [[ -f "$_self_dir/relay.js" ]] && cp "$_self_dir/relay.js" "$CAC_DIR/relay.js"
1223
-
1224
1224
  # Shims
1225
1225
  _write_hostname_shim
1226
1226
  _write_ifconfig_shim
@@ -1230,10 +1230,6 @@ _ensure_initialized() {
1230
1230
  _write_machine_id_shim
1231
1231
  fi
1232
1232
 
1233
- # DNS guard + blocked hosts
1234
- _write_dns_guard_js 2>/dev/null || true
1235
- _write_blocked_hosts 2>/dev/null || true
1236
-
1237
1233
  # mTLS CA
1238
1234
  _generate_ca_cert 2>/dev/null || true
1239
1235
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-cac",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Isolate, protect, and manage your Claude Code — versions, environments, identity, and proxy.",
5
5
  "bin": {
6
6
  "cac": "cac"