Class: Ace::Support::Models::CLI::Commands::Cache::Status
- Inherits:
-
Cli::Command
- Object
- Cli::Command
- Ace::Support::Models::CLI::Commands::Cache::Status
- Includes:
- Cli::Base
- Defined in:
- lib/ace/support/models/cli/commands/cache/status.rb
Overview
Show cache info (freshness, age, counts)
Instance Method Summary collapse
Instance Method Details
#call(**options) ⇒ Object
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/ace/support/models/cli/commands/cache/status.rb', line 19 def call(**) status_data = Organisms::SyncOrchestrator.new.status if [:json] puts JSON.pretty_generate(status_data) return end unless status_data[:cached] raise Ace::Support::Cli::Error.new("No cache data. Run 'ace-models sync' first.") end puts "Cache Status:" puts " Cached: Yes" puts " Fresh: #{status_data[:fresh] ? "Yes" : "No (stale)"}" puts " Last sync: #{status_data[:last_sync_at]}" puts if status_data[:stats] puts "Statistics:" puts " Providers: #{status_data[:stats][:provider_count]}" puts " Models: #{status_data[:stats][:model_count]}" puts puts "Top providers by model count:" status_data[:stats][:top_providers].each do |provider, count| puts " #{provider}: #{count}" end end end |