Class: ClaudeMemory::Commands::RejectCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- ClaudeMemory::Commands::RejectCommand
- Defined in:
- lib/claude_memory/commands/reject_command.rb
Overview
Mark a fact as rejected (e.g. a distiller hallucination). Closes any open conflicts involving the fact.
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
-
#call(args) ⇒ Integer
Exit code (0 for success, 1 for failure).
Methods inherited from BaseCommand
Constructor Details
This class inherits a constructor from ClaudeMemory::Commands::BaseCommand
Instance Method Details
#call(args) ⇒ Integer
Returns exit code (0 for success, 1 for failure).
12 13 14 15 16 17 18 19 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 |
# File 'lib/claude_memory/commands/reject_command.rb', line 12 def call(args) opts = (args, {scope: "project", reason: nil}) do |o| OptionParser.new do |parser| parser. = "Usage: claude-memory reject <fact_id_or_docid> [options]" parser.on("--scope SCOPE", %w[project global], "Database scope (default: project)") { |v| o[:scope] = v } parser.on("--reason TEXT", "Why this fact is wrong (recorded in conflict notes)") { |v| o[:reason] = v } end end return 1 if opts.nil? identifier = args.first return failure("Usage: claude-memory reject <fact_id_or_docid> [options]") if identifier.nil? || identifier.empty? manager = ClaudeMemory::Store::StoreManager.new store = manager.store_for_scope(opts[:scope]) fact_id = resolve_fact_id(store, identifier) unless fact_id stderr.puts "Fact '#{identifier}' not found in #{opts[:scope]} database." manager.close return 1 end result = store.reject_fact(fact_id, reason: opts[:reason]) manager.close if result.nil? stderr.puts "Fact ##{fact_id} not found." return 1 end stdout.puts "Rejected fact ##{fact_id} in #{opts[:scope]} database." stdout.puts "Resolved #{result[:conflicts_resolved]} open conflict(s)." if result[:conflicts_resolved] > 0 0 end |