Sha256: 51784e3e70572094e064ce4c181d2be9fe51e43a38d1cbe830a1e2265794bf56

Contents?: true

Size: 976 Bytes

Versions: 5

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

module Luo
  module CLI
    module Commands
      extend Dry::CLI::Registry

      class Version < Dry::CLI::Command
        desc "Print version"

        def call(*)
          puts Luo::VERSION
        end
      end

      class Init < Dry::CLI::Command
        desc "Init Luo Project"

        def call(*)
          Luo::InitProject.run
        end
      end

      class Commit < Dry::CLI::Command
        desc "Commit with Luo"

        argument :message, desc: "Commit message", required: true, type: :string

        def call(message:, **)
          messages = Messages.create.system(prompt: Luo::Prompts.luo_commit, context: {commit: message}).to_a
          response = OpenAI.new.chat(messages)
          exec "git commit -m '#{response}'"
        end
      end

      register "version", Version, aliases: %w[v -v --version]
      register "commit", Commit, aliases: ["c"]
      register "init", Init, aliases: ["i"]
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
luo-0.1.9 lib/luo/cli.rb
luo-0.1.8 lib/luo/cli.rb
luo-0.1.7 lib/luo/cli.rb
luo-0.1.6 lib/luo/cli.rb
luo-0.1.5 lib/luo/cli.rb