code_healer 0.1.17 → 0.1.19
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/lib/code_healer/claude_code_evolution_handler.rb +3 -2
- data/lib/code_healer/config_manager.rb +2 -1
- data/lib/code_healer/evolution_job.rb +1 -1
- data/lib/code_healer/healing_job.rb +1 -1
- data/lib/code_healer/pull_request_creator.rb +1 -1
- data/lib/code_healer/setup.rb +75 -63
- data/lib/code_healer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c459c5cc71ce5eb54b3a1798f45698c8910c71de4c9359aca6ebe143c90c9b2a
|
4
|
+
data.tar.gz: e521d7a05da6c0653efa4845c4d2e3770569331c699afb5a72b0df5fa7d70d90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72c3f09042c407fa37e82e88bae86a3df5fe6c0dd5ad4db832dfa69fe5531da9c2b60e4b5ae2c9e871d97a7b1b0603e205ebda328d4bcf1b88bf2b04c5df3322
|
7
|
+
data.tar.gz: defe95f38e8783909646739c05dc77ac8745847d13a00090fd8665027e506cb423eb367a4cb9ff05c5214594041ab3ba8ba9fe0f590f1231931bd3f28ecf0467
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.1.19] - 2025-08-21
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- **Critical Git Operations Duplication**: Fixed duplicate Git operations between evolution handler and workspace manager.
|
14
|
+
- **Branch Detection**: Fixed automatic detection of repository's default branch (master vs main).
|
15
|
+
- **Configuration Loading**: Fixed pr_target_branch configuration loading from both git section and root level.
|
16
|
+
- **Workspace Isolation**: Improved Git operations to occur only in isolated workspace, preventing conflicts.
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
- **Evolution Handler**: Removed duplicate Git operations to prevent conflicts with workspace manager.
|
20
|
+
- **Setup Script**: Enhanced with automatic branch detection and better configuration structure.
|
21
|
+
|
22
|
+
## [0.1.18] - 2025-08-21
|
23
|
+
|
24
|
+
### Fixed
|
25
|
+
- **Critical YAML Generation Bug**: Fixed incorrect indentation in setup script that caused YAML parsing errors.
|
26
|
+
- **Configuration File Structure**: Corrected all YAML indentation issues in generated configuration files.
|
27
|
+
|
10
28
|
## [0.1.17] - 2025-08-21
|
11
29
|
|
12
30
|
### Added
|
@@ -31,8 +31,9 @@ module CodeHealer
|
|
31
31
|
reload_modified_files
|
32
32
|
|
33
33
|
# 🚀 Trigger Git operations (commit, push, PR creation)
|
34
|
-
|
35
|
-
|
34
|
+
# Note: Git operations are now handled by the isolated workspace manager
|
35
|
+
# to prevent duplication and ensure proper isolation
|
36
|
+
puts "🔄 Git operations will be handled by isolated workspace manager..."
|
36
37
|
|
37
38
|
return true
|
38
39
|
else
|
@@ -189,7 +189,8 @@ module CodeHealer
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def pr_target_branch
|
192
|
-
|
192
|
+
# Check both git section and root level for backward compatibility
|
193
|
+
git_settings['pr_target_branch'] || config['pr_target_branch'] || 'main'
|
193
194
|
end
|
194
195
|
|
195
196
|
def commit_message_template
|
@@ -25,7 +25,7 @@ class EvolutionJob
|
|
25
25
|
healing_branch = CodeHealer::HealingWorkspaceManager.create_healing_branch(
|
26
26
|
Rails.root.to_s,
|
27
27
|
workspace_path,
|
28
|
-
CodeHealer::ConfigManager.
|
28
|
+
CodeHealer::ConfigManager.pr_target_branch
|
29
29
|
)
|
30
30
|
|
31
31
|
if healing_branch
|
@@ -68,7 +68,7 @@ module CodeHealer
|
|
68
68
|
healing_branch = CodeHealer::HealingWorkspaceManager.create_healing_branch(
|
69
69
|
Rails.root.to_s,
|
70
70
|
workspace_path,
|
71
|
-
CodeHealer::ConfigManager.
|
71
|
+
CodeHealer::ConfigManager.pr_target_branch
|
72
72
|
)
|
73
73
|
git_time_ms = ((Process.clock_gettime(Process::CLOCK_MONOTONIC) - git_started_at) * 1000).round
|
74
74
|
|
@@ -27,7 +27,7 @@ module CodeHealer
|
|
27
27
|
puts "Creating pull request for branch: #{branch_name}"
|
28
28
|
|
29
29
|
# Get target branch from configuration
|
30
|
-
target_branch = ConfigManager.pr_target_branch
|
30
|
+
target_branch = ConfigManager.pr_target_branch
|
31
31
|
puts "📋 Target branch for PR: #{target_branch}"
|
32
32
|
|
33
33
|
pr = client.create_pull_request(
|
data/lib/code_healer/setup.rb
CHANGED
@@ -256,7 +256,17 @@ github_repo_url = normalize_repository_url(github_repo, github_token)
|
|
256
256
|
puts
|
257
257
|
puts "🌿 Git Branch Configuration:"
|
258
258
|
branch_prefix = ask_for_input("Enter branch prefix for healing branches (default: evolve):", default: "evolve")
|
259
|
-
|
259
|
+
|
260
|
+
# Detect the actual default branch from git
|
261
|
+
default_branch = "main"
|
262
|
+
if system("git rev-parse --verify master >/dev/null 2>&1")
|
263
|
+
default_branch = "master"
|
264
|
+
elsif system("git rev-parse --verify main >/dev/null 2>&1")
|
265
|
+
default_branch = "main"
|
266
|
+
end
|
267
|
+
|
268
|
+
puts "🔍 Detected default branch: #{default_branch}"
|
269
|
+
pr_target_branch = ask_for_input("Enter target branch for pull requests (default: #{default_branch}):", default: default_branch)
|
260
270
|
|
261
271
|
# Code Heal Directory Configuration
|
262
272
|
puts
|
@@ -356,17 +366,17 @@ puts
|
|
356
366
|
|
357
367
|
# Create actual .env file (will be ignored by git)
|
358
368
|
env_content = <<~ENV
|
359
|
-
|
369
|
+
# CodeHealer Configuration
|
360
370
|
# OpenAI Configuration
|
361
|
-
|
371
|
+
OPENAI_API_KEY=#{openai_key}
|
362
372
|
|
363
373
|
# GitHub Configuration
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
ENV
|
374
|
+
GITHUB_TOKEN=#{github_token}
|
375
|
+
GITHUB_REPOSITORY=#{github_repo}
|
376
|
+
|
377
|
+
# Optional: Redis Configuration
|
378
|
+
REDIS_URL=redis://localhost:6379/0
|
379
|
+
ENV
|
370
380
|
|
371
381
|
create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
372
382
|
|
@@ -375,36 +385,36 @@ create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
|
375
385
|
# CodeHealer Configuration
|
376
386
|
enabled: true
|
377
387
|
|
378
|
-
|
388
|
+
# Allowed classes for healing (customize as needed)
|
379
389
|
allowed_classes:
|
380
390
|
- User
|
381
391
|
- Order
|
382
392
|
- PaymentProcessor
|
383
|
-
|
393
|
+
- OrderProcessor
|
384
394
|
|
385
|
-
|
395
|
+
# Excluded classes (never touch these)
|
386
396
|
excluded_classes:
|
387
397
|
- ApplicationController
|
388
398
|
- ApplicationRecord
|
389
399
|
- ApplicationJob
|
390
400
|
- ApplicationMailer
|
391
|
-
|
401
|
+
- ApplicationHelper
|
392
402
|
|
393
403
|
# Allowed error types for healing
|
394
404
|
allowed_error_types:
|
395
|
-
|
396
|
-
|
405
|
+
- ZeroDivisionError
|
406
|
+
- NoMethodError
|
397
407
|
- ArgumentError
|
398
|
-
|
408
|
+
- TypeError
|
399
409
|
- NameError
|
400
410
|
- ValidationError
|
401
411
|
|
402
|
-
|
412
|
+
# Evolution Strategy Configuration
|
403
413
|
evolution_strategy:
|
404
|
-
|
405
|
-
|
414
|
+
method: #{evolution_method} # Options: api, claude_code_terminal, hybrid
|
415
|
+
fallback_to_api: #{fallback_to_api} # If Claude Code fails, fall back to API
|
406
416
|
|
407
|
-
|
417
|
+
# Claude Code Terminal Configuration
|
408
418
|
claude_code:
|
409
419
|
enabled: #{evolution_method == 'claude_code_terminal' || evolution_method == 'hybrid'}
|
410
420
|
timeout: #{enable_demo_mode ? 60 : 300} # Shorter timeout for demo mode
|
@@ -423,16 +433,16 @@ create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
|
423
433
|
- "docs/business_logic.md"
|
424
434
|
- "spec/business_context_specs.rb"
|
425
435
|
|
426
|
-
|
436
|
+
# Business Context Configuration
|
427
437
|
business_context:
|
428
438
|
enabled: true
|
429
|
-
|
430
|
-
|
439
|
+
sources:
|
440
|
+
- "docs/business_rules.md"
|
431
441
|
|
432
442
|
# OpenAI API configuration
|
433
443
|
api:
|
434
444
|
provider: openai
|
435
|
-
|
445
|
+
model: gpt-4
|
436
446
|
max_tokens: 2000
|
437
447
|
temperature: 0.1
|
438
448
|
|
@@ -440,53 +450,55 @@ create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
|
440
450
|
git:
|
441
451
|
auto_commit: true
|
442
452
|
auto_push: true
|
443
|
-
|
444
|
-
|
453
|
+
branch_prefix: "#{branch_prefix}"
|
454
|
+
commit_message_template: 'Fix {{class_name}}\#\#{{method_name}}: {{error_type}}'
|
455
|
+
|
456
|
+
# Pull Request target branch (for backward compatibility)
|
445
457
|
pr_target_branch: "#{pr_target_branch}"
|
446
|
-
|
447
|
-
|
458
|
+
|
459
|
+
# Pull Request Configuration
|
448
460
|
pull_request:
|
449
461
|
enabled: true
|
450
462
|
auto_create: true
|
451
463
|
labels:
|
452
464
|
- "auto-fix"
|
453
|
-
|
465
|
+
- "self-evolving"
|
454
466
|
- "bug-fix"
|
455
467
|
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
468
|
+
# Safety Configuration
|
469
|
+
safety:
|
470
|
+
backup_before_evolution: true
|
471
|
+
rollback_on_syntax_error: true
|
472
|
+
|
473
|
+
# Evolution Limits
|
474
|
+
max_evolutions_per_day: 10
|
475
|
+
|
476
|
+
# Notification Configuration (optional)
|
477
|
+
notifications:
|
478
|
+
enabled: false
|
479
|
+
slack_webhook: ""
|
480
|
+
email_notifications: false
|
481
|
+
|
482
|
+
# Demo Mode Configuration
|
483
|
+
demo:
|
484
|
+
enabled: #{enable_demo_mode}
|
485
|
+
skip_tests: #{demo_config[:skip_tests] || false}
|
486
|
+
skip_pr: #{demo_config[:skip_pr] || false}
|
487
|
+
|
488
|
+
# Performance Configuration
|
489
|
+
performance:
|
490
|
+
max_concurrent_healing: 3
|
491
|
+
healing_timeout: 300
|
492
|
+
retry_attempts: 3
|
493
|
+
|
494
|
+
# Code Heal Directory Configuration
|
495
|
+
code_heal_directory:
|
496
|
+
path: "#{code_heal_directory}"
|
497
|
+
auto_cleanup: #{auto_cleanup}
|
498
|
+
cleanup_after_hours: #{cleanup_after_hours}
|
499
|
+
max_workspaces: 10
|
500
|
+
clone_strategy: "branch" # Options: branch, full_repo
|
501
|
+
sticky_workspace: #{enable_demo_mode} # Reuse workspace for faster demo responses
|
490
502
|
YAML
|
491
503
|
|
492
504
|
create_file_with_content('config/code_healer.yml', config_content, dry_run: options[:dry_run])
|
data/lib/code_healer/version.rb
CHANGED