Class: XAeonAgents::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/x_aeon_agents/cli.rb

Overview

Main X-Aeon Agents CLI

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns whether to exit on command failure.

Returns:

  • (Boolean)

    Always returns true so Thor exits with a non-zero status on command failure



369
370
371
# File 'lib/x_aeon_agents/cli.rb', line 369

def self.exit_on_failure?
  true
end

Instance Method Details

#commitObject

Commits staged changes with an AI-generated commit message.



68
69
70
71
72
73
# File 'lib/x_aeon_agents/cli.rb', line 68

def commit
  Agents::CommitterAgent.new(
    session_id: options[:session_id],
    stage: options[:stage].to_sym
  ).run
end

#create_prObject

Push changes on Github and create a Pull Request.



99
100
101
102
103
104
105
# File 'lib/x_aeon_agents/cli.rb', line 99

def create_pr
  agent_kwargs = {
    base_sha: options[:base]
  }
  agent_kwargs[:requirements] = options[:requirements] if options[:requirements]
  Agents::PullRequestCreatorAgent.new(session_id: options[:session_id]).run(**agent_kwargs)
end

#generate_readmeObject

Generates or updates the project README file.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/x_aeon_agents/cli.rb', line 149

def generate_readme
  agent_kwargs = {
    gen_about: options[:about],
    gen_quick_start: options[:quick_start],
    gen_requirements: options[:requirements],
    gen_features: options[:features],
    gen_public_api: options[:public_api],
    gen_documentation: options[:documentation],
    gen_how_it_works: options[:how_it_works],
    gen_development: options[:development],
    gen_contributing: options[:contributing],
    gen_license: options[:license]
  }
  agent_kwargs[:readme_file_path] = options[:readme_file_path] if options[:readme_file_path]
  Agents::ReadmeGeneratorAgent.new(session_id: options[:session_id]).run(**agent_kwargs)
end

#generate_skillsObject

Note:

Exits with status 1 if skill generation fails

Generates skill files from ERB templates in skills.src/.



192
193
194
195
196
197
198
# File 'lib/x_aeon_agents/cli.rb', line 192

def generate_skills
  result = Agents::SkillGeneratorAgent.new(session_id: options[:session_id]).run(
    output_dir: options[:output_dir],
    skill_names: options[:skill]
  )
  exit 1 unless result[:success]
end

#implement(requirements) ⇒ Object

Implements arbitrary requirements using AI.

Parameters:

  • requirements (String)

    Free-form requirements describing the desired changes



247
248
249
250
251
252
253
# File 'lib/x_aeon_agents/cli.rb', line 247

def implement(requirements)
  Agents::DeveloperAgent.new(
    commit: options[:commit],
    pull_request: options[:pr],
    session_id: options[:session_id]
  ).run(requirements:)
end

#implement_issue(github_issue_number) ⇒ Object

Implements a GitHub issue using AI.

Parameters:

  • github_issue_number (Integer)

    The GitHub issue number to implement



219
220
221
222
223
224
225
# File 'lib/x_aeon_agents/cli.rb', line 219

def implement_issue(github_issue_number)
  Agents::IssueImplementerAgent.new(
    commit: true,
    pull_request: true,
    session_id: options[:session_id]
  ).run(github_issue_number: Integer(github_issue_number))
end

#install_skillsObject

Installs skills and their dependencies from the .skills manifest.



327
328
329
330
331
# File 'lib/x_aeon_agents/cli.rb', line 327

def install_skills
  Agents::SkillInstallerAgent.new(session_id: options[:session_id]).run(
    agent: options[:agent].to_sym
  )
end

#interpret_diffs(base = 'HEAD') ⇒ Object

Summarizes current git diffs relative to a base ref.

Parameters:

  • base (String) (defaults to: 'HEAD')

    Git reference to diff against



275
276
277
278
279
280
281
282
283
284
# File 'lib/x_aeon_agents/cli.rb', line 275

def interpret_diffs(base = 'HEAD')
  output = Agents::GitDiffInterpreterAgent.new(session_id: options[:session_id]).run(git_ref_base: base)
  puts <<~EO_OUTPUT
    ===== Code diffs interpretation:

    #{output[:one_line_summary].strip}

    #{output[:change_intent].strip}
  EO_OUTPUT
end

#prompt(user_prompt) ⇒ Object

Sends a one-shot prompt to the AI agent and prints the response.

Parameters:

  • user_prompt (String)

    The prompt text to send to the AI agent



304
305
306
307
308
# File 'lib/x_aeon_agents/cli.rb', line 304

def prompt(user_prompt)
  agent = Agents::ExecutorAgent.new(session_id: options[:session_id], **Config.agent_options['free_simple'])
  agent.run(user_instructions: user_prompt)
  puts agent.conversation.last[:message]
end

#review_comments(pull_request_number = nil) ⇒ Object

Addresses review comments on a GitHub Pull Request.

Parameters:

  • pull_request_number (Integer, nil) (defaults to: nil)

    The GitHub Pull Request number to process, or nil to auto-detect



32
33
34
35
36
# File 'lib/x_aeon_agents/cli.rb', line 32

def review_comments(pull_request_number = nil)
  Agents::ReviewResolverAgent.new(session_id: options[:session_id]).run(
    pull_request_number: pull_request_number ? Integer(pull_request_number) : nil
  )
end

#start_taskObject

Opens a new git worktree for a feature branch.



354
355
356
357
358
359
360
# File 'lib/x_aeon_agents/cli.rb', line 354

def start_task
  branch = options[:branch] || begin
    puts 'Branch name:'
    $stdin.gets.strip
  end
  Agents::TaskStarterAgent.new(session_id: options[:session_id]).run(branch_name: branch)
end