Class: ClaudeMemory::Commands::ConflictsCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/claude_memory/commands/conflicts_command.rb

Overview

Shows open conflicts in memory

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdin, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#initialize

Constructor Details

This class inherits a constructor from ClaudeMemory::Commands::BaseCommand

Instance Method Details

#call(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/claude_memory/commands/conflicts_command.rb', line 7

def call(args)
  opts = parse_options(args, {scope: "all"}) do |o|
    OptionParser.new do |parser|
      parser.on("--scope SCOPE", "Scope: project, global, or all") { |v| o[:scope] = v }
    end
  end
  return 1 if opts.nil?

  manager = ClaudeMemory::Store::StoreManager.new
  recall = ClaudeMemory::Recall.new(manager)
  conflicts = recall.conflicts(scope: opts[:scope])

  if conflicts.empty?
    stdout.puts "No open conflicts."
  else
    stdout.puts "Open conflicts (#{conflicts.size}):\n\n"
    conflicts.each do |c|
      source_label = c[:source] ? " [#{c[:source]}]" : ""
      stdout.puts "  Conflict ##{c[:id]}: Fact #{c[:fact_a_id]} vs Fact #{c[:fact_b_id]}#{source_label}"
      stdout.puts "    Status: #{c[:status]}, Detected: #{c[:detected_at]}"
      stdout.puts "    Notes: #{c[:notes]}" if c[:notes]
      stdout.puts
    end
  end

  manager.close
  0
end