@anthropic-ai/claude-code 0.2.52 → 0.2.53

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 (3) hide show
  1. package/claude-restart.sh +1 -20
  2. package/cli.js +3700 -1076
  3. package/package.json +1 -1
package/claude-restart.sh CHANGED
@@ -6,7 +6,6 @@
6
6
  # 1. Launches the CLI with the same arguments passed to this script
7
7
  # 2. Monitors the CLI process for a special exit code (42)
8
8
  # 3. If the special exit code is detected, it restarts the CLI with the same arguments
9
- # 4. Prevents infinite restart loops by limiting restart attempts
10
9
 
11
10
  # Get the directory where this script is located
12
11
  SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@@ -21,11 +20,6 @@ CLI_PATH="$SCRIPT_DIR/cli.js"
21
20
  # Using exit code 42 as our special signal
22
21
  RESTART_EXIT_CODE=42
23
22
 
24
- # Track restart attempts to prevent infinite restart loops
25
- RESTART_COUNT=0
26
- MAX_RESTARTS=5
27
- RESTART_RESET_TIME=60 # 1 minute in seconds
28
-
29
23
  # Check if cli.mjs exists
30
24
  if [ ! -f "$CLI_PATH" ]; then
31
25
  echo "Error: Could not find $CLI_PATH"
@@ -45,13 +39,7 @@ start_cli() {
45
39
  # If second parameter is not "true", just remove first parameter
46
40
  args=("${args[@]:1}")
47
41
  fi
48
-
49
- # If we restart too many times in a short period, exit
50
- if [ $RESTART_COUNT -ge $MAX_RESTARTS ]; then
51
- echo "Too many restarts ($RESTART_COUNT) in a short period. Exiting."
52
- exit 1
53
- fi
54
-
42
+
55
43
  # If this is a restart triggered by exit code 42 and no args are provided, add 'resume 0' to restore the last conversation
56
44
  if [ "$is_restart" = "true" ] && [ ${#args[@]} -eq 0 ]; then
57
45
  # Always add resume 0 when restarting due to exit code 42 and no other arguments exist
@@ -66,13 +54,6 @@ start_cli() {
66
54
 
67
55
  # Check if we need to restart
68
56
  if [ $EXIT_CODE -eq $RESTART_EXIT_CODE ]; then
69
- RESTART_COUNT=$((RESTART_COUNT + 1))
70
-
71
- # Reset restart counter after some time (in background)
72
- (
73
- sleep $RESTART_RESET_TIME
74
- RESTART_COUNT=0
75
- ) &
76
57
 
77
58
  # When restarting due to exit code 42, filter args to keep only flags (starting with - or --)
78
59
  # and add "resume 0" at the end