claude-cac 1.4.4-beta.1 → 1.4.4-beta.2

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 +13 -12
  2. 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.4.4-beta.1"
14
+ CAC_VERSION="1.4.4-beta.2"
15
15
 
16
16
  _read() { [[ -f "$1" ]] && tr -d '[:space:]' < "$1" || echo "${2:-}"; }
17
17
  _die() { printf '%b\n' "$(_red "error:") $*" >&2; exit 1; }
@@ -52,12 +52,12 @@ _gen_uuid() {
52
52
  elif [[ -f /proc/sys/kernel/random/uuid ]]; then
53
53
  cat /proc/sys/kernel/random/uuid
54
54
  else
55
- python3 -c "import uuid; print(uuid.uuid4())"
55
+ python3 -c "import uuid; print(uuid.uuid4())" || _die "python3 required for UUID generation (install python3 or uuidgen)"
56
56
  fi
57
57
  }
58
58
  _new_uuid() { _gen_uuid | tr '[:lower:]' '[:upper:]'; }
59
59
  _new_sid() { _gen_uuid | tr '[:upper:]' '[:lower:]'; }
60
- _new_user_id() { python3 -c "import os; print(os.urandom(32).hex())"; }
60
+ _new_user_id() { python3 -c "import os; print(os.urandom(32).hex())" || _die "python3 required"; }
61
61
  _new_machine_id() { _gen_uuid | tr -d '-' | tr '[:upper:]' '[:lower:]'; }
62
62
  _new_hostname() { echo "host-$(_gen_uuid | cut -d- -f1 | tr '[:upper:]' '[:lower:]')"; }
63
63
  _new_mac() { printf '02:%02x:%02x:%02x:%02x:%02x' $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)); }
@@ -921,9 +921,9 @@ _check_mtls() {
921
921
  if openssl verify -CAfile "$ca_cert" "$client_cert" >/dev/null 2>&1; then
922
922
  # check certificate expiry
923
923
  local expiry
924
- expiry=$(openssl x509 -in "$client_cert" -noout -enddate 2>/dev/null | cut -d= -f2)
924
+ expiry=$(openssl x509 -in "$client_cert" -noout -enddate 2>/dev/null | cut -d= -f2 || true)
925
925
  local cn
926
- cn=$(openssl x509 -in "$client_cert" -noout -subject 2>/dev/null | sed 's/.*CN *= *//')
926
+ cn=$(openssl x509 -in "$client_cert" -noout -subject 2>/dev/null | sed 's/.*CN *= *//' || true)
927
927
  echo "$(_green "✓") mTLS certificate valid (CN=$cn, expires: $expiry)"
928
928
  return 0
929
929
  else
@@ -1480,7 +1480,7 @@ _ensure_initialized() {
1480
1480
  if [[ -n "$_cac_bin" ]] && [[ -L "$_cac_bin" ]]; then
1481
1481
  local _link; _link="$(readlink "$_cac_bin")"
1482
1482
  [[ "$_link" != /* ]] && _link="$(dirname "$_cac_bin")/$_link"
1483
- _self_dir="$(cd "$(dirname "$_link")" && pwd)"
1483
+ _self_dir="$(cd "$(dirname "$_link")" 2>/dev/null && pwd)" || _self_dir=""
1484
1484
  fi
1485
1485
  # Fallback: directory of the running script
1486
1486
  if [[ -z "$_self_dir" ]] || [[ ! -f "$_self_dir/relay.js" ]]; then
@@ -1577,7 +1577,7 @@ _env_cmd_create() {
1577
1577
  if [[ ! "$proxy" =~ ^(http|https|socks5):// ]]; then
1578
1578
  printf " $(_dim "Detecting proxy protocol ...") "
1579
1579
  if proxy_url=$(_auto_detect_proxy "$proxy"); then
1580
- echo "$(_cyan "$(echo "$proxy_url" | grep -oE '^[a-z]+')")"
1580
+ echo "$(_cyan "$(echo "$proxy_url" | grep -oE '^[a-z]+' || echo "http")")"
1581
1581
  else
1582
1582
  echo "$(_yellow "failed, defaulting to http")"
1583
1583
  fi
@@ -1883,7 +1883,7 @@ _env_cmd_set() {
1883
1883
  if [[ ! "$value" =~ ^(http|https|socks5):// ]]; then
1884
1884
  printf " $(_dim "Detecting proxy protocol ...") "
1885
1885
  if proxy_url=$(_auto_detect_proxy "$value"); then
1886
- echo "$(_cyan "$(echo "$proxy_url" | grep -oE '^[a-z]+')")"
1886
+ echo "$(_cyan "$(echo "$proxy_url" | grep -oE '^[a-z]+' || echo "http")")"
1887
1887
  else
1888
1888
  echo "$(_yellow "failed, defaulting to http")"
1889
1889
  fi
@@ -1990,7 +1990,7 @@ _relay_stop() {
1990
1990
  if [[ -f "$pid_file" ]]; then
1991
1991
  local pid; pid=$(tr -d '[:space:]' < "$pid_file")
1992
1992
  if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then
1993
- kill "$pid" 2>/dev/null
1993
+ kill "$pid" 2>/dev/null || true
1994
1994
  # wait for process exit
1995
1995
  local _i
1996
1996
  for _i in {1..20}; do
@@ -2289,7 +2289,7 @@ cmd_check() {
2289
2289
 
2290
2290
  # ── concurrent sessions ──
2291
2291
  local _claude_count
2292
- _claude_count=$(pgrep -x "claude" 2>/dev/null | wc -l | tr -d '[:space:]')
2292
+ _claude_count=$(pgrep -x "claude" 2>/dev/null | wc -l | tr -d '[:space:]') || _claude_count=0
2293
2293
  local _max_sessions; _max_sessions=$(_cac_setting max_sessions 10)
2294
2294
  if [[ "$_claude_count" -gt "$_max_sessions" ]]; then
2295
2295
  echo " $(_yellow "⚠") sessions $_claude_count running (threshold: $_max_sessions)"
@@ -2381,7 +2381,7 @@ cmd_check() {
2381
2381
 
2382
2382
  # ── summary ──
2383
2383
  echo
2384
- if [[ ${#problems[@]} -eq 0 ]]; then
2384
+ if [[ ${#problems[@]:-0} -eq 0 ]]; then
2385
2385
  echo " $(_green "✓") all good"
2386
2386
  else
2387
2387
  for p in "${problems[@]}"; do
@@ -2770,7 +2770,8 @@ _dk_detect_network() {
2770
2770
  return 1
2771
2771
  fi
2772
2772
 
2773
- addr=$(ip -4 addr show "$iface" | awk '/inet /{print $2; exit}')
2773
+ addr=$(ip -4 addr show "$iface" 2>/dev/null | awk '/inet /{print $2; exit}') || addr=""
2774
+ [[ -z "$addr" ]] && { echo "error: cannot get address for $iface" >&2; return 1; }
2774
2775
  ip="${addr%/*}"
2775
2776
  prefix="${addr#*/}"
2776
2777
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-cac",
3
- "version": "1.4.4-beta.1",
3
+ "version": "1.4.4-beta.2",
4
4
  "description": "Isolate, protect, and manage your Claude Code — versions, environments, identity, and proxy.",
5
5
  "bin": {
6
6
  "cac": "cac"