Class: ClaudeMemory::Commands::ChangesCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- ClaudeMemory::Commands::ChangesCommand
- Defined in:
- lib/claude_memory/commands/changes_command.rb
Overview
Shows recent fact changes
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
Methods inherited from BaseCommand
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 35 36 |
# File 'lib/claude_memory/commands/changes_command.rb', line 7 def call(args) opts = (args, {since: nil, limit: 20, scope: "all"}) do |o| OptionParser.new do |parser| parser.on("--since ISO", "Since timestamp") { |v| o[:since] = v } parser.on("--limit N", Integer, "Max results") { |v| o[:limit] = v } parser.on("--scope SCOPE", "Scope: project, global, or all") { |v| o[:scope] = v } end end return 1 if opts.nil? opts[:since] ||= (Time.now - 86400 * 7).utc.iso8601 manager = ClaudeMemory::Store::StoreManager.new recall = ClaudeMemory::Recall.new(manager) changes = recall.changes(since: opts[:since], limit: opts[:limit], scope: opts[:scope]) if changes.empty? stdout.puts "No changes since #{opts[:since]}." else stdout.puts "Changes since #{opts[:since]} (#{changes.size}):\n\n" changes.each do |change| source_label = change[:source] ? " [#{change[:source]}]" : "" stdout.puts " [#{change[:id]}] #{change[:predicate]}: #{change[:object_literal]} (#{change[:status]})#{source_label}" stdout.puts " Created: #{change[:created_at]}" end end manager.close 0 end |