Module: AIGit::Commands::Config

Defined in:
lib/ai_git/commands/config.rb

Class Method Summary collapse

Class Method Details

.call(_argv = []) ⇒ Object



27
28
29
30
31
32
# File 'lib/ai_git/commands/config.rb', line 27

def call(_argv = [])
  rows = resolved_rows(AIGit::Config)

  AIGit::UI.heading("ai_git configuration")
  rows.each { |key, value| AIGit::UI.kv(key, value) }
end

.config_file(cfg) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/ai_git/commands/config.rb', line 45

def config_file(cfg)
  return cfg.config_path if cfg.config_path

  dir = cfg.config_dir
  return "(no home directory)" if dir.nil?

  "#{File.join(dir, AIGit::Config::CONFIG_FILENAMES.first)} (not found)"
end

.resolved_rows(cfg) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/ai_git/commands/config.rb', line 34

def resolved_rows(cfg)
  [
    ["Provider", cfg.provider],
    ["Model", cfg.model_name],
    ["Base URL", cfg.base_url],
    ["Endpoint", cfg.endpoint],
    ["Read timeout", "#{AIGit::AIClient::READ_TIMEOUT_SECONDS}s"],
    ["Config file", config_file(cfg)]
  ]
end