Class: ClaudeMemory::Commands::DedupeConflictsCommand

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

Overview

One-time cleanup for historical conflict-row duplication caused by a resolver bug that created a new disputed fact + conflict row each time the same contradicting value was re-extracted (see Resolver#apply_conflict dedupe fix landed 2026-04-24). New conflicts can no longer duplicate this way; this command cleans the tail.

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



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/dedupe_conflicts_command.rb', line 13

def call(args)
  opts = parse_options(args, {scope: "project", dry_run: false}) do |o|
    OptionParser.new do |parser|
      parser.banner = "Usage: claude-memory dedupe-conflicts [options]"
      parser.on("--scope SCOPE", %w[project global], "Database scope (default: project)") { |v| o[:scope] = v }
      parser.on("--dry-run", "Show what would be resolved without writing") { o[:dry_run] = true }
    end
  end
  return 1 if opts.nil?

  manager = ClaudeMemory::Store::StoreManager.new
  store = manager.store_for_scope(opts[:scope])

  begin
    result = Sweep::Maintenance.new(store).dedupe_open_conflicts(dry_run: opts[:dry_run])
  ensure
    manager.close
  end

  print_result(opts, result)
  0
end