Class: ClaudeMemory::Commands::StatsCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- ClaudeMemory::Commands::StatsCommand
- Defined in:
- lib/claude_memory/commands/stats_command.rb
Overview
Displays detailed statistics about the memory system Shows facts by status and predicate, entities by type, content items, provenance coverage, conflicts, and database sizes
Constant Summary collapse
- SCOPE_ALL =
"all"- SCOPE_GLOBAL =
"global"- SCOPE_PROJECT =
"project"
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
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 47 |
# File 'lib/claude_memory/commands/stats_command.rb', line 15 def call(args) opts = (args, {scope: SCOPE_ALL, tools: false, since_days: nil}) do |o| OptionParser.new do |parser| parser. = "Usage: claude-memory stats [options]" parser.on("--scope SCOPE", ["all", "global", "project"], "Show stats for: all (default), global, or project") { |v| o[:scope] = v } parser.on("--tools", "Show MCP tool-call usage stats") { o[:tools] = true } parser.on("--since DAYS", Integer, "Limit --tools to last N days") { |v| o[:since_days] = v } end end return 1 if opts.nil? if opts[:tools] return print_mcp_tool_call_stats(opts[:since_days]) end manager = ClaudeMemory::Store::StoreManager.new stdout.puts "ClaudeMemory Statistics" stdout.puts "=" * 50 stdout.puts if opts[:scope] == SCOPE_ALL || opts[:scope] == SCOPE_GLOBAL print_database_stats("GLOBAL", manager.global_db_path) end if opts[:scope] == SCOPE_ALL || opts[:scope] == SCOPE_PROJECT print_database_stats("PROJECT", manager.project_db_path) end manager.close 0 end |