claude-evolve 1.4.9 → 1.4.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.
- package/bin/claude-evolve-autostatus +17 -3
- package/bin/claude-evolve-main +21 -14
- package/lib/config.py +92 -0
- package/package.json +1 -1
|
@@ -17,10 +17,24 @@ from datetime import datetime
|
|
|
17
17
|
|
|
18
18
|
# Add parent directory to path for imports
|
|
19
19
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
|
20
|
-
|
|
20
|
+
parent_dir = os.path.join(script_dir, '..')
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
# Try multiple paths to support both development and installed environments
|
|
23
|
+
for path in [parent_dir, os.path.join(parent_dir, 'lib'), script_dir]:
|
|
24
|
+
if path not in sys.path:
|
|
25
|
+
sys.path.insert(0, path)
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
from lib.config import Config
|
|
29
|
+
from lib.evolution_csv import EvolutionCSV
|
|
30
|
+
except ImportError:
|
|
31
|
+
# Fallback for installed version where lib might be in a different location
|
|
32
|
+
try:
|
|
33
|
+
from config import Config
|
|
34
|
+
from evolution_csv import EvolutionCSV
|
|
35
|
+
except ImportError:
|
|
36
|
+
print("Error: Could not import required modules. Please check installation.", file=sys.stderr)
|
|
37
|
+
sys.exit(1)
|
|
24
38
|
|
|
25
39
|
|
|
26
40
|
class TerminalDisplay:
|
package/bin/claude-evolve-main
CHANGED
|
@@ -64,6 +64,7 @@ COMMANDS:
|
|
|
64
64
|
analyze Analyze evolution results
|
|
65
65
|
edit Manage candidate statuses by generation
|
|
66
66
|
status Show evolution progress and current leader
|
|
67
|
+
autostatus Auto-updating status display (real-time)
|
|
67
68
|
cleanup Clean up unchanged algorithms and descendants
|
|
68
69
|
cleanup-duplicates Alias for cleanup (deprecated)
|
|
69
70
|
help Show this help message
|
|
@@ -91,15 +92,16 @@ show_menu() {
|
|
|
91
92
|
echo
|
|
92
93
|
echo "What would you like to do?"
|
|
93
94
|
echo
|
|
94
|
-
echo " 1) setup
|
|
95
|
-
echo " 2) ideate
|
|
96
|
-
echo " 3) run
|
|
97
|
-
echo " 4) analyze
|
|
98
|
-
echo " 5) edit
|
|
99
|
-
echo " 6) status
|
|
100
|
-
echo " 7)
|
|
101
|
-
echo " 8)
|
|
102
|
-
echo " 9)
|
|
95
|
+
echo " 1) setup - Initialize evolution workspace"
|
|
96
|
+
echo " 2) ideate - Generate new algorithm ideas"
|
|
97
|
+
echo " 3) run - Execute evolution candidates"
|
|
98
|
+
echo " 4) analyze - Analyze evolution results"
|
|
99
|
+
echo " 5) edit - Manage candidate statuses by generation"
|
|
100
|
+
echo " 6) status - Show evolution progress and current leader"
|
|
101
|
+
echo " 7) autostatus - Auto-updating status display (real-time)"
|
|
102
|
+
echo " 8) config - Manage configuration settings"
|
|
103
|
+
echo " 9) help - Show help message"
|
|
104
|
+
echo " 0) exit - Exit"
|
|
103
105
|
echo
|
|
104
106
|
|
|
105
107
|
# Show workspace status
|
|
@@ -145,7 +147,7 @@ check_for_updates
|
|
|
145
147
|
# Main logic
|
|
146
148
|
if [[ $# -eq 0 ]]; then
|
|
147
149
|
show_menu
|
|
148
|
-
read -r -p "Enter your choice (1-9): " choice
|
|
150
|
+
read -r -p "Enter your choice (1-9, 0): " choice
|
|
149
151
|
|
|
150
152
|
case $choice in
|
|
151
153
|
1) exec "$SCRIPT_DIR/claude-evolve-setup" ;;
|
|
@@ -154,14 +156,15 @@ if [[ $# -eq 0 ]]; then
|
|
|
154
156
|
4) exec "$SCRIPT_DIR/claude-evolve-analyze" ;;
|
|
155
157
|
5) exec "$SCRIPT_DIR/claude-evolve-edit" ;;
|
|
156
158
|
6) exec "$SCRIPT_DIR/claude-evolve-status" ;;
|
|
157
|
-
7) exec "$SCRIPT_DIR/claude-evolve-
|
|
158
|
-
8)
|
|
159
|
-
9)
|
|
159
|
+
7) exec "$SCRIPT_DIR/claude-evolve-autostatus" ;;
|
|
160
|
+
8) exec "$SCRIPT_DIR/claude-evolve-config" ;;
|
|
161
|
+
9) show_help ;;
|
|
162
|
+
0)
|
|
160
163
|
echo "Goodbye!"
|
|
161
164
|
exit 0
|
|
162
165
|
;;
|
|
163
166
|
*)
|
|
164
|
-
echo -e "${RED}Invalid choice. Please select 1-9.${NC}"
|
|
167
|
+
echo -e "${RED}Invalid choice. Please select 1-9 or 0.${NC}"
|
|
165
168
|
exit 1
|
|
166
169
|
;;
|
|
167
170
|
esac
|
|
@@ -198,6 +201,10 @@ status)
|
|
|
198
201
|
shift
|
|
199
202
|
exec "$SCRIPT_DIR/claude-evolve-status" "$@"
|
|
200
203
|
;;
|
|
204
|
+
autostatus)
|
|
205
|
+
shift
|
|
206
|
+
exec "$SCRIPT_DIR/claude-evolve-autostatus" "$@"
|
|
207
|
+
;;
|
|
201
208
|
cleanup-duplicates|cleanup)
|
|
202
209
|
shift
|
|
203
210
|
exec "$SCRIPT_DIR/claude-evolve-cleanup" "$@"
|
package/lib/config.py
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Configuration loader for claude-evolve Python scripts."""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import yaml
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Config:
|
|
10
|
+
"""Configuration manager that matches the bash config.sh functionality."""
|
|
11
|
+
|
|
12
|
+
# Default values matching config.sh
|
|
13
|
+
DEFAULTS = {
|
|
14
|
+
'evolution_dir': 'evolution',
|
|
15
|
+
'algorithm_file': 'algorithm.py',
|
|
16
|
+
'evaluator_file': 'evaluator.py',
|
|
17
|
+
'brief_file': 'BRIEF.md',
|
|
18
|
+
'csv_file': 'evolution.csv',
|
|
19
|
+
'output_dir': '',
|
|
20
|
+
'parent_selection': 'best',
|
|
21
|
+
'python_cmd': 'python3',
|
|
22
|
+
'ideation': {
|
|
23
|
+
'total_ideas': 15,
|
|
24
|
+
'novel_exploration': 3,
|
|
25
|
+
'hill_climbing': 5,
|
|
26
|
+
'structural_mutation': 3,
|
|
27
|
+
'crossover_hybrid': 4,
|
|
28
|
+
'num_elites': 3,
|
|
29
|
+
'num_revolution': 2
|
|
30
|
+
},
|
|
31
|
+
'parallel': {
|
|
32
|
+
'enabled': False,
|
|
33
|
+
'max_workers': 4,
|
|
34
|
+
'lock_timeout': 10
|
|
35
|
+
},
|
|
36
|
+
'auto_ideate': True,
|
|
37
|
+
'max_retries': 3
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
def __init__(self):
|
|
41
|
+
self.data = self.DEFAULTS.copy()
|
|
42
|
+
self.config_path = None
|
|
43
|
+
self.working_dir = None
|
|
44
|
+
|
|
45
|
+
def load(self, config_path=None, working_dir=None):
|
|
46
|
+
"""Load configuration from YAML file."""
|
|
47
|
+
# Determine config file path
|
|
48
|
+
if config_path:
|
|
49
|
+
# Explicit config path provided
|
|
50
|
+
self.config_path = Path(config_path)
|
|
51
|
+
elif working_dir:
|
|
52
|
+
# Look for config.yaml in working directory
|
|
53
|
+
self.working_dir = Path(working_dir)
|
|
54
|
+
self.config_path = self.working_dir / 'config.yaml'
|
|
55
|
+
else:
|
|
56
|
+
# Default to evolution/config.yaml
|
|
57
|
+
self.config_path = Path('evolution/config.yaml')
|
|
58
|
+
|
|
59
|
+
# Load config if it exists
|
|
60
|
+
if self.config_path.exists():
|
|
61
|
+
with open(self.config_path, 'r') as f:
|
|
62
|
+
yaml_data = yaml.safe_load(f) or {}
|
|
63
|
+
|
|
64
|
+
# Merge with defaults
|
|
65
|
+
self.data.update(yaml_data)
|
|
66
|
+
|
|
67
|
+
# Handle nested structures
|
|
68
|
+
if 'ideation' in yaml_data:
|
|
69
|
+
self.data['ideation'] = {**self.DEFAULTS['ideation'], **yaml_data['ideation']}
|
|
70
|
+
if 'parallel' in yaml_data:
|
|
71
|
+
self.data['parallel'] = {**self.DEFAULTS['parallel'], **yaml_data['parallel']}
|
|
72
|
+
|
|
73
|
+
def resolve_path(self, relative_path):
|
|
74
|
+
"""Resolve a path relative to the config directory."""
|
|
75
|
+
if not relative_path:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
# If config_path is set, use its parent directory
|
|
79
|
+
if self.config_path:
|
|
80
|
+
base_dir = self.config_path.parent
|
|
81
|
+
elif self.working_dir:
|
|
82
|
+
base_dir = self.working_dir
|
|
83
|
+
else:
|
|
84
|
+
base_dir = Path.cwd()
|
|
85
|
+
|
|
86
|
+
# Handle output_dir special case
|
|
87
|
+
if relative_path == self.data.get('output_dir', '') and not relative_path:
|
|
88
|
+
# Empty output_dir means use evolution_dir
|
|
89
|
+
relative_path = self.data.get('evolution_dir', 'evolution')
|
|
90
|
+
|
|
91
|
+
resolved = base_dir / relative_path
|
|
92
|
+
return str(resolved.resolve())
|