claude-evolve 1.0.10 → 1.0.11

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.
@@ -2,10 +2,16 @@
2
2
 
3
3
  set -e
4
4
 
5
+ # Load configuration
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ # shellcheck source=../lib/config.sh
8
+ source "$SCRIPT_DIR/../lib/config.sh"
9
+ load_config
10
+
5
11
  # Parse arguments
6
12
  open_chart=false
7
- csv_file="evolution/evolution.csv"
8
- output_file="evolution/performance.png"
13
+ csv_file="$FULL_CSV_PATH"
14
+ output_file="$FULL_OUTPUT_DIR/performance.png"
9
15
 
10
16
  while [[ $# -gt 0 ]]; do
11
17
  case $1 in
@@ -2,6 +2,12 @@
2
2
 
3
3
  set -e
4
4
 
5
+ # Load configuration
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ # shellcheck source=../lib/config.sh
8
+ source "$SCRIPT_DIR/../lib/config.sh"
9
+ load_config
10
+
5
11
  # Parse arguments
6
12
  timeout_seconds=""
7
13
 
@@ -46,18 +52,27 @@ done
46
52
  echo "[INFO] Starting evolution run..."
47
53
  [[ -n $timeout_seconds ]] && echo "[INFO] Using timeout: ${timeout_seconds} seconds"
48
54
 
49
- # Validate workspace
50
- if [[ ! -d evolution ]]; then
51
- echo "[ERROR] Evolution directory not found. Run 'claude-evolve setup' first." >&2
55
+ # Validate workspace using config
56
+ if [[ ! -d "$FULL_EVOLUTION_DIR" ]]; then
57
+ echo "[ERROR] Evolution directory not found: $FULL_EVOLUTION_DIR. Run 'claude-evolve setup' first." >&2
52
58
  exit 1
53
59
  fi
54
60
 
55
- for file in evolution.csv evaluator.py; do
56
- if [[ ! -f evolution/$file ]]; then
57
- echo "[ERROR] $file not found. Run 'claude-evolve setup' first." >&2
58
- exit 1
59
- fi
60
- done
61
+ # Check required files
62
+ if [[ ! -f "$FULL_CSV_PATH" ]]; then
63
+ echo "[ERROR] CSV file not found: $FULL_CSV_PATH" >&2
64
+ exit 1
65
+ fi
66
+
67
+ if [[ ! -f "$FULL_EVALUATOR_PATH" ]]; then
68
+ echo "[ERROR] Evaluator not found: $FULL_EVALUATOR_PATH" >&2
69
+ exit 1
70
+ fi
71
+
72
+ if [[ ! -f "$FULL_ALGORITHM_PATH" ]]; then
73
+ echo "[ERROR] Algorithm not found: $FULL_ALGORITHM_PATH" >&2
74
+ exit 1
75
+ fi
61
76
 
62
77
  # Find oldest empty row (pure shell)
63
78
  find_empty_row() {
@@ -68,13 +83,13 @@ find_empty_row() {
68
83
  return 0
69
84
  fi
70
85
  ((row_num++))
71
- done < <(tail -n +2 evolution/evolution.csv)
86
+ done < <(tail -n +2 "$FULL_CSV_PATH")
72
87
  return 1
73
88
  }
74
89
 
75
90
  # Get CSV row (pure shell)
76
91
  get_csv_row() {
77
- sed -n "${1}p" evolution/evolution.csv
92
+ sed -n "${1}p" "$FULL_CSV_PATH"
78
93
  }
79
94
 
80
95
  # Update CSV row (pure shell with temp file)
@@ -84,7 +99,7 @@ update_csv_row() {
84
99
  local status="$3"
85
100
 
86
101
  # Read CSV and update specific row
87
- local temp_file="evolution/evolution.csv.tmp"
102
+ local temp_file="${FULL_CSV_PATH}.tmp"
88
103
  local current_row=1
89
104
 
90
105
  while IFS=, read -r id based_on desc perf stat; do
@@ -96,9 +111,9 @@ update_csv_row() {
96
111
  echo "$id,$based_on,$desc,$perf,$stat"
97
112
  fi
98
113
  ((current_row++))
99
- done <evolution/evolution.csv >"$temp_file"
114
+ done <"$FULL_CSV_PATH" >"$temp_file"
100
115
 
101
- mv "$temp_file" evolution/evolution.csv
116
+ mv "$temp_file" "$FULL_CSV_PATH"
102
117
  }
103
118
 
104
119
  # Find next candidate
@@ -126,9 +141,9 @@ trap 'update_csv_row "$row_num" "" "interrupted"; echo "[INFO] Evolution interru
126
141
  update_csv_row "$row_num" "" "running"
127
142
 
128
143
  # Determine parent algorithm
129
- parent_file="evolution/algorithm.py"
144
+ parent_file="$FULL_ALGORITHM_PATH"
130
145
  if [[ -n $based_on_id && $based_on_id != "0" ]]; then
131
- parent_file="evolution/evolution_id${based_on_id}.py"
146
+ parent_file="$FULL_OUTPUT_DIR/evolution_id${based_on_id}.py"
132
147
  if [[ ! -f $parent_file ]]; then
133
148
  echo "[ERROR] Parent algorithm file not found: $parent_file" >&2
134
149
  update_csv_row "$row_num" "" "failed"
@@ -139,7 +154,7 @@ fi
139
154
  echo "[INFO] Using parent algorithm: $parent_file"
140
155
 
141
156
  # Generate mutation
142
- output_file="evolution/evolution_id${id}.py"
157
+ output_file="$FULL_OUTPUT_DIR/evolution_id${id}.py"
143
158
  echo "[INFO] Generating algorithm mutation..."
144
159
 
145
160
  # Copy parent algorithm to output file first
@@ -156,8 +171,8 @@ fi
156
171
 
157
172
  # Implement claude-fsd style model selection
158
173
  # Read/create loop counter for megathinking mode
159
- if [[ -f evolution/.loop_counter ]]; then
160
- LOOP_COUNTER=$(cat evolution/.loop_counter)
174
+ if [[ -f "$FULL_EVOLUTION_DIR/.loop_counter" ]]; then
175
+ LOOP_COUNTER=$(cat "$FULL_EVOLUTION_DIR/.loop_counter")
161
176
  else
162
177
  LOOP_COUNTER=1
163
178
  fi
@@ -175,13 +190,13 @@ else
175
190
  fi
176
191
 
177
192
  # Increment and save counter
178
- echo $((LOOP_COUNTER + 1)) > evolution/.loop_counter
193
+ echo $((LOOP_COUNTER + 1)) > "$FULL_EVOLUTION_DIR/.loop_counter"
179
194
 
180
195
  # Create mutation prompt
181
196
  prompt="${MEGATHINK_PREFIX}You are an AI assistant helping to evolve algorithms through mutations. Please modify the Python algorithm file at $output_file based on the requested modification.
182
197
 
183
198
  CONTEXT:
184
- $(cat evolution/BRIEF.md 2>/dev/null || echo "No brief available")
199
+ $(cat "$FULL_BRIEF_PATH" 2>/dev/null || echo "No brief available")
185
200
 
186
201
  ALGORITHM FILE TO MODIFY: $output_file
187
202
 
@@ -216,7 +231,7 @@ eval_exit_code=0
216
231
 
217
232
  if [[ -n $timeout_seconds ]]; then
218
233
  echo "[INFO] Starting evaluation with ${timeout_seconds}s timeout..."
219
- if eval_output=$(timeout "$timeout_seconds" python3 evolution/evaluator.py "$output_file" 2>&1); then
234
+ if eval_output=$(timeout "$timeout_seconds" "$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
220
235
  eval_exit_code=0
221
236
  else
222
237
  eval_exit_code=$?
@@ -227,7 +242,7 @@ if [[ -n $timeout_seconds ]]; then
227
242
  fi
228
243
  fi
229
244
  else
230
- if eval_output=$(python3 evolution/evaluator.py "$output_file" 2>&1); then
245
+ if eval_output=$("$PYTHON_CMD" "$FULL_EVALUATOR_PATH" "$output_file" 2>&1); then
231
246
  eval_exit_code=0
232
247
  else
233
248
  eval_exit_code=$?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",