Class: Luo::CLI::APP
- Inherits:
-
Thor
- Object
- Thor
- Luo::CLI::APP
- Defined in:
- lib/luo/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/luo/cli.rb', line 36 def self.exit_on_failure? if $! && $!.is_a?(Thor::Error) command = "luo " + ARGV.join(' ') = Messages.create.user(prompt: Luo::Prompts.luo_error, context: {error: $!., command: command}).to_a if ENV["LUO_LLM_MODE"] == "openai" response = OpenAI.new.chat() else response = Xinghuo.new.chat() end shell = Thor::Shell::Color.new shell.say "\n #{response}", :green end true end |
Instance Method Details
#__print_version ⇒ Object
11 12 13 |
# File 'lib/luo/cli.rb', line 11 def __print_version puts "Luo version #{Luo::VERSION}" end |
#commit(message) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/luo/cli.rb', line 16 def commit() = Messages.create.user(prompt: Luo::Prompts.luo_commit, context: {commit: }).to_a if ENV["LUO_LLM_MODE"] == "openai" response = OpenAI.new.chat() else response = Xinghuo.new.chat() end exec "git commit -m '#{response}'" end |
#init ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/luo/cli.rb', line 28 def init if [:type] == "notebook" invoke InitNotebook elsif [:type] == "app" invoke InitApp end end |