Class: Internator::CodexService

Inherits:
Object
  • Object
show all
Defined in:
lib/internator/codex_service.rb

Overview

Service for executing the Codex CLI with full-auto mode

Instance Method Summary collapse

Constructor Details

#initialize(instruction) ⇒ CodexService

Returns a new instance of CodexService.

Parameters:

  • instruction (String)

    Text instruction for Codex



5
6
7
# File 'lib/internator/codex_service.rb', line 5

def initialize(instruction)
  @instruction = instruction
end

Instance Method Details

#callInteger

Executes ‘codex –full-auto` with the provided instruction.

Returns:

  • (Integer)

    Exit code of the Codex process



11
12
13
14
15
16
17
18
19
20
# File 'lib/internator/codex_service.rb', line 11

def call
  command = [
    "codex",
    "exec",
    "--full-auto",
    @instruction
  ]
  system(*command)
  $?.exitstatus
end