Class: SwarmMemory::CLI::Commands

Inherits:
Object
  • Object
show all
Defined in:
lib/swarm_memory/cli/commands.rb

Overview

CLI commands for managing SwarmMemory embeddings

Registers with SwarmCLI to provide:

swarm memory setup      - Download embedding model
swarm memory status     - Check model cache status
swarm memory model-path - Show cache location
swarm memory defrag     - Optimize memory storage
swarm memory rebuild    - Rebuild all embeddings

Class Method Summary collapse

Class Method Details

.execute(args) ⇒ void

This method returns an undefined value.

Execute memory command (called by SwarmCLI)

Parameters:

  • args (Array<String>)

    Command arguments (e.g., ["defrag", ".swarm/memory"])



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/swarm_memory/cli/commands.rb', line 19

def execute(args)
  subcommand = args.first
  subcommand_args = args[1..] # Remaining args after subcommand

  case subcommand
  when "setup"
    setup_embeddings
  when "status"
    show_status
  when "model-path"
    show_model_path
  when "defrag"
    defrag_memory(subcommand_args)
  when "rebuild"
    rebuild_embeddings(subcommand_args)
  else
    show_help
    exit(1)
  end
rescue StandardError => e
  $stderr.puts "Error: #{e.message}"
  exit(1)
end