@anthropic-ai/claude-code 0.2.56 → 0.2.59
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.
- package/claude-restart.sh +19 -2
- package/cli.js +934 -677
- package/package.json +1 -1
package/claude-restart.sh
CHANGED
|
@@ -20,9 +20,11 @@ CLI_PATH="$SCRIPT_DIR/cli.js"
|
|
|
20
20
|
# DO NOT change the current working directory
|
|
21
21
|
# The CLI needs to maintain the original working directory it was launched from
|
|
22
22
|
|
|
23
|
-
# Define the
|
|
24
|
-
# Using exit code 42 as our special signal
|
|
23
|
+
# Define the signals we'll use to indicate a restart is needed
|
|
24
|
+
# Using exit code 42 as our special signal for command-based restart
|
|
25
25
|
RESTART_EXIT_CODE=42
|
|
26
|
+
# Using exit code 43 as our special signal for tool-based restart
|
|
27
|
+
TOOL_RESTART_EXIT_CODE=43
|
|
26
28
|
|
|
27
29
|
# Check if cli.mjs exists
|
|
28
30
|
if [ ! -f "$CLI_PATH" ]; then
|
|
@@ -71,6 +73,21 @@ start_cli() {
|
|
|
71
73
|
# Add resume 0 at the end
|
|
72
74
|
restart_args+=("resume" "0")
|
|
73
75
|
|
|
76
|
+
start_cli "true" "${restart_args[@]}"
|
|
77
|
+
elif [ $EXIT_CODE -eq $TOOL_RESTART_EXIT_CODE ]; then
|
|
78
|
+
|
|
79
|
+
# When restarting due to exit code 43 (tool restart), filter args to keep only flags (starting with - or --)
|
|
80
|
+
# and use "Keep going.." prompt instead
|
|
81
|
+
local restart_args=()
|
|
82
|
+
for arg in "${args[@]}"; do
|
|
83
|
+
if [[ "$arg" == -* ]]; then
|
|
84
|
+
restart_args+=("$arg")
|
|
85
|
+
fi
|
|
86
|
+
done
|
|
87
|
+
|
|
88
|
+
# Start with "Keep going.." prompt
|
|
89
|
+
restart_args+=("Keep going..")
|
|
90
|
+
|
|
74
91
|
start_cli "true" "${restart_args[@]}"
|
|
75
92
|
else
|
|
76
93
|
# Any other exit code - exit with the same code
|