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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87529c94cd83d16eef532144bb5d03d7f9ac588fdbf8cfe89ae167e6722cf329
4
- data.tar.gz: b0d57d027ebf3e59e1e5515d27148aa5887c4ed6110a5b4de6af57e1785105f7
3
+ metadata.gz: c459c5cc71ce5eb54b3a1798f45698c8910c71de4c9359aca6ebe143c90c9b2a
4
+ data.tar.gz: e521d7a05da6c0653efa4845c4d2e3770569331c699afb5a72b0df5fa7d70d90
5
5
  SHA512:
6
- metadata.gz: 7e543125b2ac69159ca0a244ea7249c2fcc38c5947acaf6ff82b3955aec7b35dbf425adcb5bcb3ac89766ec3b01ba2d5668d44ced1c57741d8407e9af8af921d
7
- data.tar.gz: d67d88d8c80f0ddb0b712131cb7841e7903055cc8db86e1ce46ee18bbfb8a3b5de18e78221b12234577b77bf927588c5a78716f548833ec1146635b661843c95
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
- puts "🔄 Starting Git operations..."
35
- trigger_git_operations(error, class_name, method_name, file_path)
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
- git_settings['pr_target_branch'] || 'main'
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.git_settings['pr_target_branch'] || 'main'
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.git_settings['pr_target_branch'] || 'main'
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 || 'main'
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(
@@ -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
- pr_target_branch = ask_for_input("Enter target branch for pull requests (default: main):", default: "main")
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
- # CodeHealer Configuration
369
+ # CodeHealer Configuration
360
370
  # OpenAI Configuration
361
- OPENAI_API_KEY=#{openai_key}
371
+ OPENAI_API_KEY=#{openai_key}
362
372
 
363
373
  # GitHub Configuration
364
- GITHUB_TOKEN=#{github_token}
365
- GITHUB_REPOSITORY=#{github_repo}
366
-
367
- # Optional: Redis Configuration
368
- REDIS_URL=redis://localhost:6379/0
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
- # Allowed classes for healing (customize as needed)
388
+ # Allowed classes for healing (customize as needed)
379
389
  allowed_classes:
380
390
  - User
381
391
  - Order
382
392
  - PaymentProcessor
383
- - OrderProcessor
393
+ - OrderProcessor
384
394
 
385
- # Excluded classes (never touch these)
395
+ # Excluded classes (never touch these)
386
396
  excluded_classes:
387
397
  - ApplicationController
388
398
  - ApplicationRecord
389
399
  - ApplicationJob
390
400
  - ApplicationMailer
391
- - ApplicationHelper
401
+ - ApplicationHelper
392
402
 
393
403
  # Allowed error types for healing
394
404
  allowed_error_types:
395
- - ZeroDivisionError
396
- - NoMethodError
405
+ - ZeroDivisionError
406
+ - NoMethodError
397
407
  - ArgumentError
398
- - TypeError
408
+ - TypeError
399
409
  - NameError
400
410
  - ValidationError
401
411
 
402
- # Evolution Strategy Configuration
412
+ # Evolution Strategy Configuration
403
413
  evolution_strategy:
404
- method: #{evolution_method} # Options: api, claude_code_terminal, hybrid
405
- fallback_to_api: #{fallback_to_api} # If Claude Code fails, fall back to API
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
- # Claude Code Terminal Configuration
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
- # Business Context Configuration
436
+ # Business Context Configuration
427
437
  business_context:
428
438
  enabled: true
429
- sources:
430
- - "docs/business_rules.md"
439
+ sources:
440
+ - "docs/business_rules.md"
431
441
 
432
442
  # OpenAI API configuration
433
443
  api:
434
444
  provider: openai
435
- model: gpt-4
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
- branch_prefix: "#{branch_prefix}"
444
- commit_message_template: 'Fix {{class_name}}\#\#{{method_name}}: {{error_type}}'
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
- # Pull Request Configuration
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
- - "self-evolving"
465
+ - "self-evolving"
454
466
  - "bug-fix"
455
467
 
456
- # Safety Configuration
457
- safety:
458
- backup_before_evolution: true
459
- rollback_on_syntax_error: true
460
-
461
- # Evolution Limits
462
- max_evolutions_per_day: 10
463
-
464
- # Notification Configuration (optional)
465
- notifications:
466
- enabled: false
467
- slack_webhook: ""
468
- email_notifications: false
469
-
470
- # Demo Mode Configuration
471
- demo:
472
- enabled: #{enable_demo_mode}
473
- skip_tests: #{demo_config[:skip_tests] || false}
474
- skip_pr: #{demo_config[:skip_pr] || false}
475
-
476
- # Performance Configuration
477
- performance:
478
- max_concurrent_healing: 3
479
- healing_timeout: 300
480
- retry_attempts: 3
481
-
482
- # Code Heal Directory Configuration
483
- code_heal_directory:
484
- path: "#{code_heal_directory}"
485
- auto_cleanup: #{auto_cleanup}
486
- cleanup_after_hours: #{cleanup_after_hours}
487
- max_workspaces: 10
488
- clone_strategy: "branch" # Options: branch, full_repo
489
- sticky_workspace: #{enable_demo_mode} # Reuse workspace for faster demo responses
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])
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CodeHealer
4
- VERSION = "0.1.17"
4
+ VERSION = "0.1.19"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code_healer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepan Kumar