Module: Aircana::CLI::DoctorHelpers::SystemChecks

Included in:
Aircana::CLI::Doctor
Defined in:
lib/aircana/cli/commands/doctor_helpers.rb

Instance Method Summary collapse

Instance Method Details

#claude_available?Boolean

Returns:

  • (Boolean)


33
34
35
36
# File 'lib/aircana/cli/commands/doctor_helpers.rb', line 33

def claude_available?
  claude_path = find_claude_path
  !claude_path.nil? && File.executable?(claude_path)
end

#command_available?(command) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/aircana/cli/commands/doctor_helpers.rb', line 29

def command_available?(command)
  system("which #{command}", out: File::NULL, err: File::NULL)
end

#detect_osObject



54
55
56
57
58
59
# File 'lib/aircana/cli/commands/doctor_helpers.rb', line 54

def detect_os
  return "macOS" if RUBY_PLATFORM.match?(/darwin/)
  return "Ubuntu/Debian" if File.exist?("/etc/debian_version")

  "Other"
end

#find_claude_pathObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/aircana/cli/commands/doctor_helpers.rb', line 38

def find_claude_path
  possible_paths = [
    File.expand_path("~/.claude/local/claude"),
    `which claude 2>/dev/null`.strip,
    "/usr/local/bin/claude"
  ]

  possible_paths.each do |path|
    return path if !path.empty? && File.exist?(path) && File.executable?(path)
  end

  return "claude" if system("which claude > /dev/null 2>&1")

  nil
end