Class: ClaudeMemory::Commands::PromoteCommand

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

Overview

Promotes a project fact to global 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
# File 'lib/claude_memory/commands/promote_command.rb', line 7

def call(args)
  fact_id = args.first&.to_i
  unless fact_id && fact_id > 0
    stderr.puts "Usage: claude-memory promote <fact_id>"
    stderr.puts "\nPromotes a project fact to the global database."
    return 1
  end

  manager = ClaudeMemory::Store::StoreManager.new
  global_fact_id = manager.promote_fact(fact_id)

  if global_fact_id
    stdout.puts "Promoted fact ##{fact_id} to global database as fact ##{global_fact_id}"
    manager.close
    0
  else
    stderr.puts "Fact ##{fact_id} not found in project database."
    manager.close
    1
  end
end