claude-evolve 1.4.10 → 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.
@@ -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
- sys.path.insert(0, os.path.join(script_dir, '..'))
20
+ parent_dir = os.path.join(script_dir, '..')
21
21
 
22
- from lib.config import Config
23
- from lib.evolution_csv import EvolutionCSV
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/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())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-evolve",
3
- "version": "1.4.10",
3
+ "version": "1.4.11",
4
4
  "bin": {
5
5
  "claude-evolve": "./bin/claude-evolve",
6
6
  "claude-evolve-main": "./bin/claude-evolve-main",