Class: Ace::Git::Organisms::DiffOrchestrator
- Inherits:
-
Object
- Object
- Ace::Git::Organisms::DiffOrchestrator
- Defined in:
- lib/ace/git/organisms/diff_orchestrator.rb
Overview
Orchestrates the complete diff workflow (NO caching per task decisions) Migrated from ace-git-diff
Class Method Summary collapse
-
.for_range(range, options = {}) ⇒ Models::DiffResult
Generate diff for a specific range.
-
.from_config(config_hash) ⇒ Models::DiffResult
Generate diff from configuration hash.
-
.generate(options = {}) ⇒ Models::DiffResult
Generate diff with full workflow: config -> generate -> filter -> result.
-
.raw(options = {}) ⇒ Models::DiffResult
Generate raw (unfiltered) diff.
-
.save_to_file(output_path, options = {}) ⇒ String
Generate diff and save to file.
-
.save_with_format(output_path, format: :diff, **options) ⇒ String
Generate diff and save to file (with explicit format).
-
.since(since, options = {}) ⇒ Models::DiffResult
Generate diff since a date or commit.
-
.smart(options = {}) ⇒ Models::DiffResult
Generate diff with smart defaults (based on git state).
-
.staged(options = {}) ⇒ Models::DiffResult
Generate staged diff.
-
.working(options = {}) ⇒ Models::DiffResult
Generate working directory diff.
Class Method Details
.for_range(range, options = {}) ⇒ Models::DiffResult
Generate diff for a specific range
61 62 63 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 61 def for_range(range, = {}) generate(.merge(ranges: [range])) end |
.from_config(config_hash) ⇒ Models::DiffResult
Generate diff from configuration hash
52 53 54 55 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 52 def from_config(config_hash) diff_config = Molecules::ConfigLoader.extract_diff_config(config_hash) generate(diff_config) end |
.generate(options = {}) ⇒ Models::DiffResult
Generate diff with full workflow: config -> generate -> filter -> result
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 20 def generate( = {}) # Load configuration config = Molecules::ConfigLoader.load() # Short-circuit for grouped_stats — only numstat needed, skip full diff if config.format == :grouped_stats return build_grouped_stats_result(config, nil, filtered: !config.exclude_patterns.empty?) end # Generate raw diff raw_diff = Molecules::DiffGenerator.generate(config) # Filter diff filtered_diff = Molecules::DiffFilter.filter(raw_diff, config) # Parse and create result parsed = Atoms::DiffParser.parse(filtered_diff) Models::DiffResult.from_parsed( parsed, metadata: { config: config.to_h, generated_at: Time.now.iso8601, filtered: !config.exclude_patterns.empty? }, filtered: !config.exclude_patterns.empty? ) end |
.raw(options = {}) ⇒ Models::DiffResult
Generate raw (unfiltered) diff
98 99 100 101 102 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 98 def raw( = {}) # Temporarily override exclude patterns to be empty = .merge(exclude_patterns: []) generate() end |
.save_to_file(output_path, options = {}) ⇒ String
Generate diff and save to file
108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 108 def save_to_file(output_path, = {}) result = generate() # Create parent directories if needed require "fileutils" FileUtils.mkdir_p(File.dirname(output_path)) unless File.dirname(output_path) == "." # Write content to file File.write(output_path, result.content) output_path end |
.save_with_format(output_path, format: :diff, **options) ⇒ String
Generate diff and save to file (with explicit format)
126 127 128 129 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 126 def save_with_format(output_path, format: :diff, **) = .merge(format: format) save_to_file(output_path, ) end |
.since(since, options = {}) ⇒ Models::DiffResult
Generate diff since a date or commit
69 70 71 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 69 def since(since, = {}) generate(.merge(since: since)) end |
.smart(options = {}) ⇒ Models::DiffResult
Generate diff with smart defaults (based on git state)
90 91 92 93 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 90 def smart( = {}) # Use empty config to trigger smart default behavior in DiffGenerator generate() end |
.staged(options = {}) ⇒ Models::DiffResult
Generate staged diff
76 77 78 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 76 def staged( = {}) generate(.merge(format: :staged)) end |
.working(options = {}) ⇒ Models::DiffResult
Generate working directory diff
83 84 85 |
# File 'lib/ace/git/organisms/diff_orchestrator.rb', line 83 def working( = {}) generate(.merge(format: :working)) end |