Class: Harnex::Doctor
- Inherits:
-
Object
- Object
- Harnex::Doctor
- Defined in:
- lib/harnex/commands/doctor.rb
Constant Summary collapse
- MIN_CODEX_VERSION =
Gem::Version.new("0.128.0")
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv = []) ⇒ Doctor
constructor
A new instance of Doctor.
- #run ⇒ Object
Constructor Details
#initialize(argv = []) ⇒ Doctor
Returns a new instance of Doctor.
33 34 35 36 37 38 39 |
# File 'lib/harnex/commands/doctor.rb', line 33 def initialize(argv = []) @argv = argv.dup @options = { sweep: false, help: false } end |
Class Method Details
.usage ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/harnex/commands/doctor.rb', line 8 def self.usage <<~TEXT Usage: harnex doctor [--sweep] Runs preflight checks for harnex's adapter dependencies. Currently verifies that Codex CLI is installed and at version >= #{MIN_CODEX_VERSION} (required for the JSON-RPC `app-server` adapter). Options: --sweep Include a read-only report of harnex/tmux session drift -h, --help Show this help Common patterns: harnex doctor harnex doctor --sweep harnex doctor --help Gotchas: doctor validates local adapter prerequisites; it does not start sessions. --sweep is diagnostic only; it does not stop sessions or remove files. Run it after installing or upgrading Codex CLI. TEXT end |
Instance Method Details
#run ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/harnex/commands/doctor.rb', line 41 def run parser.parse!(@argv) if @options[:help] puts self.class.usage return 0 end checks = [check_codex] summary = { ok: checks.all? { |c| c[:ok] }, checks: checks } summary[:sweep] = sweep_payload if @options[:sweep] puts JSON.generate(summary) summary[:ok] ? 0 : 1 end |