16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/llmemory/cli/commands/long_term/nodes.rb', line 16
def execute(argv, _opts)
user_id = argv.first
unless user_id
$stderr.puts "Usage: llmemory nodes USER_ID [--type TYPE] [--limit N]"
exit 1
end
storage = graph_based_storage(@store_type)
nodes = storage.list_nodes(user_id, entity_type: @entity_type, limit: @limit)
if nodes.empty?
puts "No nodes found for user #{user_id}."
return
end
nodes.each do |n|
id = n.respond_to?(:id) ? n.id : n[:id]
type = n.respond_to?(:entity_type) ? n.entity_type : n[:entity_type]
name = n.respond_to?(:name) ? n.name : n[:name]
puts "#{id} [#{type}] #{name}"
end
end
|