Class: ClaudeMemory::Commands::ReclassifyReferencesCommand

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

Overview

One-time cleanup for historical convention facts that are actually descriptions of external projects (LOC counts, star counts, author attributions, “X is a plugin…” templates). The Distill::ReferenceMaterialDetector now guards new writes in ManagementHandlers#store_extraction; this command walks existing rows and retags them to predicate=reference.

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/reclassify_references_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 reclassify-references [options]"
      parser.on("--scope SCOPE", %w[project global], "Database scope (default: project)") { |v| o[:scope] = v }
      parser.on("--dry-run", "Show what would be reclassified 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).reclassify_references(dry_run: opts[:dry_run])
  ensure
    manager.close
  end

  print_result(opts, result)
  0
end