code_healer 0.1.24 โ 0.1.32
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 +46 -0
- data/lib/code_healer/claude_code_evolution_handler.rb +141 -53
- data/lib/code_healer/config_manager.rb +16 -23
- data/lib/code_healer/core.rb +36 -25
- data/lib/code_healer/healing_job.rb +33 -29
- data/lib/code_healer/healing_workspace_manager.rb +132 -118
- data/lib/code_healer/mcp_server.rb +8 -7
- data/lib/code_healer/presentation_logger.rb +114 -0
- data/lib/code_healer/setup.rb +9 -45
- data/lib/code_healer/version.rb +1 -1
- metadata +3 -2
@@ -0,0 +1,114 @@
|
|
1
|
+
module CodeHealer
|
2
|
+
# Presentation-focused logger for clean operator output
|
3
|
+
class PresentationLogger
|
4
|
+
class << self
|
5
|
+
def verbose?
|
6
|
+
env_flag = ENV.fetch('CODE_HEALER_VERBOSE', 'false')
|
7
|
+
env_flag.to_s.downcase == 'true'
|
8
|
+
end
|
9
|
+
|
10
|
+
def section(title)
|
11
|
+
divider
|
12
|
+
puts "\n๐ค #{title}\n"
|
13
|
+
end
|
14
|
+
|
15
|
+
def step(message)
|
16
|
+
puts "โก๏ธ #{message}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def info(message)
|
20
|
+
puts "โน๏ธ #{message}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def success(message)
|
24
|
+
puts "โ
#{message}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def warn(message)
|
28
|
+
puts "โ ๏ธ #{message}"
|
29
|
+
end
|
30
|
+
|
31
|
+
def error(message)
|
32
|
+
puts "โ #{message}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def detail(message)
|
36
|
+
return unless verbose?
|
37
|
+
puts " ยท #{message}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def kv(label, value)
|
41
|
+
# Truncate long values for presentation
|
42
|
+
display_value = case value
|
43
|
+
when Array
|
44
|
+
if value.length > 3
|
45
|
+
"#{value.first(2).join(', ')}... (#{value.length} total)"
|
46
|
+
else
|
47
|
+
value.join(', ')
|
48
|
+
end
|
49
|
+
when String
|
50
|
+
value.length > 100 ? "#{value[0..97]}..." : value
|
51
|
+
else
|
52
|
+
value.to_s
|
53
|
+
end
|
54
|
+
puts " โข #{label}: #{display_value}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def backtrace(backtrace_array)
|
58
|
+
return unless backtrace_array&.any?
|
59
|
+
|
60
|
+
# Show only the first 3 relevant lines for presentation
|
61
|
+
relevant_lines = backtrace_array.first(3).map do |line|
|
62
|
+
# Extract just the file and line number for cleaner display
|
63
|
+
if (m = line.match(/^(.+\.rb):(\d+):in/))
|
64
|
+
file = File.basename(m[1])
|
65
|
+
line_num = m[2]
|
66
|
+
method = line.match(/in `(.+)'/)&.[](1) || 'unknown'
|
67
|
+
"#{file}:#{line_num} in #{method}"
|
68
|
+
else
|
69
|
+
line
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
puts " โข Backtrace: #{relevant_lines.join(' โ ')}"
|
74
|
+
detail("Full backtrace available with CODE_HEALER_VERBOSE=true") if backtrace_array.length > 3
|
75
|
+
end
|
76
|
+
|
77
|
+
def time(label, ms)
|
78
|
+
puts "โฑ๏ธ #{label}: #{ms} ms"
|
79
|
+
end
|
80
|
+
|
81
|
+
def divider
|
82
|
+
puts "\nโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n"
|
83
|
+
end
|
84
|
+
|
85
|
+
def outcome(success:, branch: nil, pr_url: nil, reason: nil, timing: nil)
|
86
|
+
if success
|
87
|
+
success_msg = "๐ Healing complete"
|
88
|
+
success_msg << " (#{timing})" if timing
|
89
|
+
success(success_msg)
|
90
|
+
puts " โข Branch: #{branch}" if branch
|
91
|
+
puts " โข PR: #{pr_url}" if pr_url
|
92
|
+
else
|
93
|
+
error_msg = "๐ฅ Healing failed"
|
94
|
+
error_msg << " (#{reason})" if reason
|
95
|
+
error(error_msg)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def claude_action(action)
|
100
|
+
puts "๐ค #{action}"
|
101
|
+
end
|
102
|
+
|
103
|
+
def workspace_action(action)
|
104
|
+
puts "๐๏ธ #{action}"
|
105
|
+
end
|
106
|
+
|
107
|
+
def git_action(action)
|
108
|
+
puts "๐ #{action}"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
|
data/lib/code_healer/setup.rb
CHANGED
@@ -414,34 +414,7 @@ evolution_method = case evolution_method.downcase
|
|
414
414
|
|
415
415
|
fallback_to_api = ask_for_yes_no("Fallback to API if Claude Code fails?", default: true)
|
416
416
|
|
417
|
-
|
418
|
-
puts
|
419
|
-
puts "๐ญ Demo Mode Configuration:"
|
420
|
-
puts "Demo mode optimizes CodeHealer for fast demonstrations and presentations:"
|
421
|
-
puts "- Skips test generation for faster response times"
|
422
|
-
puts "- Skips pull request creation for immediate results"
|
423
|
-
puts "- Uses optimized Claude prompts for quick fixes"
|
424
|
-
puts
|
425
|
-
|
426
|
-
enable_demo_mode = ask_for_yes_no("Enable demo mode for fast demonstrations?", default: false)
|
427
|
-
|
428
|
-
demo_config = {}
|
429
|
-
if enable_demo_mode
|
430
|
-
demo_config[:skip_tests] = ask_for_yes_no("Skip test generation in demo mode?", default: true)
|
431
|
-
|
432
|
-
|
433
|
-
puts
|
434
|
-
puts "๐ Demo mode will significantly speed up healing operations!"
|
435
|
-
puts " Perfect for conference talks and live demonstrations."
|
436
|
-
|
437
|
-
# Add demo-specific instructions
|
438
|
-
puts
|
439
|
-
puts "๐ Demo Mode Features:"
|
440
|
-
puts " - Timeout reduced to 60 seconds for quick responses"
|
441
|
-
puts " - Sticky workspace enabled for faster context loading"
|
442
|
-
puts " - Claude session persistence for better performance"
|
443
|
-
puts " - Tests skipped for immediate results (PRs still created)"
|
444
|
-
end
|
417
|
+
|
445
418
|
|
446
419
|
# Create configuration files
|
447
420
|
puts
|
@@ -481,13 +454,6 @@ create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
|
481
454
|
# CodeHealer Configuration
|
482
455
|
enabled: true
|
483
456
|
|
484
|
-
# Allowed classes for healing (customize as needed)
|
485
|
-
allowed_classes:
|
486
|
-
- User
|
487
|
-
- Order
|
488
|
-
- PaymentProcessor
|
489
|
-
- OrderProcessor
|
490
|
-
|
491
457
|
# Excluded classes (never touch these)
|
492
458
|
excluded_classes:
|
493
459
|
- ApplicationController
|
@@ -513,9 +479,9 @@ create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
|
513
479
|
# Claude Code Terminal Configuration
|
514
480
|
claude_code:
|
515
481
|
enabled: #{evolution_method == 'claude_code_terminal' || evolution_method == 'hybrid'}
|
516
|
-
timeout:
|
482
|
+
timeout: 300
|
517
483
|
max_file_changes: 10
|
518
|
-
include_tests:
|
484
|
+
include_tests: true
|
519
485
|
persist_session: true # Keep Claude session alive for faster responses
|
520
486
|
ignore:
|
521
487
|
- "tmp/"
|
@@ -608,15 +574,15 @@ create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
|
608
574
|
max_evolutions_per_day: 10
|
609
575
|
|
610
576
|
# Notification Configuration (optional)
|
577
|
+
# Test-Fix Iteration Configuration
|
578
|
+
test_fix:
|
579
|
+
max_iterations: 2
|
611
580
|
notifications:
|
612
581
|
enabled: false
|
613
582
|
slack_webhook: ""
|
614
583
|
email_notifications: false
|
615
584
|
|
616
|
-
|
617
|
-
demo:
|
618
|
-
enabled: #{enable_demo_mode}
|
619
|
-
skip_tests: #{demo_config[:skip_tests] || false}
|
585
|
+
|
620
586
|
|
621
587
|
# Performance Configuration
|
622
588
|
performance:
|
@@ -631,7 +597,7 @@ create_file_with_content('.env', env_content, dry_run: options[:dry_run])
|
|
631
597
|
cleanup_after_hours: #{cleanup_after_hours}
|
632
598
|
max_workspaces: 10
|
633
599
|
clone_strategy: "branch" # Options: branch, full_repo
|
634
|
-
sticky_workspace:
|
600
|
+
sticky_workspace: false
|
635
601
|
YAML
|
636
602
|
|
637
603
|
create_file_with_content('config/code_healer.yml', config_content, dry_run: options[:dry_run])
|
@@ -711,9 +677,7 @@ puts
|
|
711
677
|
puts " - Your code will be cloned to: #{code_heal_directory}"
|
712
678
|
puts " - This ensures safe, isolated healing without affecting your running server"
|
713
679
|
puts " - Workspaces are automatically cleaned up after #{cleanup_after_hours} hours"
|
714
|
-
|
715
|
-
puts " - Demo mode: Sticky workspace enabled for faster context loading"
|
716
|
-
end
|
680
|
+
|
717
681
|
puts
|
718
682
|
puts "โ๏ธ Configuration:"
|
719
683
|
puts " - code_healer.yml contains comprehensive settings with sensible defaults"
|
data/lib/code_healer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_healer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deepan Kumar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -401,6 +401,7 @@ files:
|
|
401
401
|
- lib/code_healer/mcp_server.rb
|
402
402
|
- lib/code_healer/mcp_tools.rb
|
403
403
|
- lib/code_healer/models/healing_metric.rb
|
404
|
+
- lib/code_healer/presentation_logger.rb
|
404
405
|
- lib/code_healer/pull_request_creator.rb
|
405
406
|
- lib/code_healer/routes.rb
|
406
407
|
- lib/code_healer/services/metrics_collector.rb
|