@anthropic-ai/claude-code 0.2.36 → 0.2.37

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 +16 -4
  2. package/cli.js +413 -424
  3. package/package.json +1 -1
package/claude-restart.sh CHANGED
@@ -52,11 +52,12 @@ start_cli() {
52
52
  exit 1
53
53
  fi
54
54
 
55
- # If this is a restart and no args are provided, add 'resume 0' to restore the last conversation
55
+ # If this is a restart triggered by exit code 42 and no args are provided, add 'resume 0' to restore the last conversation
56
56
  if [ "$is_restart" = "true" ] && [ ${#args[@]} -eq 0 ]; then
57
+ # Always add resume 0 when restarting due to exit code 42 and no other arguments exist
57
58
  args=("resume" "0")
58
59
  fi
59
-
60
+
60
61
  # Run cli.mjs with the provided arguments
61
62
  "$CLI_PATH" "${args[@]}"
62
63
 
@@ -73,8 +74,19 @@ start_cli() {
73
74
  RESTART_COUNT=0
74
75
  ) &
75
76
 
76
- # Restart with the same arguments
77
- start_cli "true" "${args[@]}"
77
+ # When restarting due to exit code 42, filter args to keep only flags (starting with - or --)
78
+ # and add "resume 0" at the end
79
+ local restart_args=()
80
+ for arg in "${args[@]}"; do
81
+ if [[ "$arg" == -* ]]; then
82
+ restart_args+=("$arg")
83
+ fi
84
+ done
85
+
86
+ # Add resume 0 at the end
87
+ restart_args+=("resume" "0")
88
+
89
+ start_cli "true" "${restart_args[@]}"
78
90
  else
79
91
  # Any other exit code - exit with the same code
80
92
  exit $EXIT_CODE