sawara 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 458a9864b8cbbd7d4122608612f9282b1ca6adbbdbbf431faa879215f01f41aa
4
- data.tar.gz: 14e1a18199efa5d09f82ebdb6ffc483ccf6cfcedc09c47c1b323bfc10a8f2cab
3
+ metadata.gz: 34bee8ad292b23c3f9263d82403ae7da181151e5bd066288c557804f11258882
4
+ data.tar.gz: 7891f97562dbbc91fc25f26f9c8fa964248cfd72b0c469c17f1760219973e95b
5
5
  SHA512:
6
- metadata.gz: 328d34fee8546615568397b8f0e99540eeb638cd565ca8168c50923e2a99f00908f1ada67ac74a01c652fdedb8f93c61a64e275413c93678d45b456571c13d8a
7
- data.tar.gz: 5dffa179894a0d330c05574f4af0c889c1ca23b2122138bcd4521e9ed2b3befdf898a0c6b865ddaae90ca2288221ad3c3ced6556025de07d0c9982d4d08d1487
6
+ metadata.gz: cc5e8e6127bdde3375dc1bf6955b6375937e9d98b202337ce6dbd1716ba404eecc21d89a23aaf4f0697e99622e0289543049c9454ce12c512e0fcd69022a645a
7
+ data.tar.gz: 894d27aa3d9218981c6f18462f2a5741de837872ea075ddd807c56747f7a0b6c5f188c34ae221a76ccfae555ad4c40f42967556d2f3ec31939fc9748c1944d97
data/.rubocop.yml CHANGED
@@ -15,3 +15,7 @@ Style/StringLiteralsInInterpolation:
15
15
 
16
16
  Layout/LineLength:
17
17
  Max: 120
18
+
19
+ Metrics/BlockLength:
20
+ Exclude:
21
+ - "spec/**/*.rb"
data/lib/sawara/config.rb CHANGED
@@ -8,7 +8,7 @@ module Sawara
8
8
  CONFIG_PATH = "#{Dir.home}/.sawara".freeze
9
9
 
10
10
  def initialize
11
- unless File.exist? CONFIG_PATH
11
+ unless File.exist?(CONFIG_PATH)
12
12
  File.new(CONFIG_PATH, 'w')
13
13
  update_config
14
14
  end
@@ -28,7 +28,7 @@ module Sawara
28
28
  def update_config
29
29
  puts 'Enter your OpenAI API Key.'
30
30
  api_key = $stdin.gets
31
- store = YAML::Store.new CONFIG_PATH
31
+ store = YAML::Store.new(CONFIG_PATH)
32
32
  store.transaction do
33
33
  store['api_key'] = api_key
34
34
  end
data/lib/sawara/talk.rb CHANGED
@@ -27,7 +27,7 @@ module Sawara
27
27
  Hint 2: To exit this conversation, press "Ctrl + d" without any message.
28
28
  MSG
29
29
  puts
30
- puts 'C h a t G P T C L I'.center(80)
30
+ puts 'S a w a r a 🐟'.center(80)
31
31
  puts '*' * 80
32
32
  puts hints
33
33
  puts '*' * 80
@@ -35,16 +35,16 @@ module Sawara
35
35
 
36
36
  def await_user_content
37
37
  puts
38
- print 'You: '
39
- content = $stdin.readlines.join
38
+ puts 'You:'
39
+ content = $stdin.readlines.join.sub(/\n*$/, '')
40
40
  @messages << { role: 'user', content: }
41
41
  content
42
42
  end
43
43
 
44
44
  def await_assistant_content(client)
45
45
  puts
46
- print 'Vanilla: '
47
- content = client.fetch(@messages).sub!(/^\R/, '')
46
+ puts 'Sawara:'
47
+ content = client.fetch(@messages).sub(/^\n*/, '')
48
48
  @messages << { role: 'assistant', content: }
49
49
  puts content
50
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sawara
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
data/sawara.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/sawara/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'sawara'
7
+ spec.version = Sawara::VERSION
8
+ spec.authors = ['yocajii']
9
+ spec.email = ['yocajii@stone.sakura.ne.jp']
10
+
11
+ spec.summary = 'This is ChatGPT CLI.'
12
+ spec.description = 'Sawara is a comannd-line tool for using ChatGPT via OpenAI API.'
13
+
14
+ spec.homepage = 'https://github.com/yocajii/sawara'
15
+ spec.license = 'MIT'
16
+ spec.required_ruby_version = '>= 3.1.0'
17
+
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = 'https://github.com/yocajii/sawara'
20
+ spec.metadata['changelog_uri'] = 'https://github.com/yocajii/sawara/blob/main/CHANGELOG.md'
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(__dir__) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (File.expand_path(f) == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = 'exe'
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ['lib']
32
+ spec.metadata['rubygems_mfa_required'] = 'true'
33
+
34
+ # Uncomment to register a new dependency of your gem
35
+ # spec.add_dependency 'example-gem', '~> 1.0'
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sawara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yocajii
@@ -10,7 +10,7 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2023-03-07 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Use ChatGPT in Terminal via OpenAI API.
13
+ description: Sawara is a comannd-line tool for using ChatGPT via OpenAI API.
14
14
  email:
15
15
  - yocajii@stone.sakura.ne.jp
16
16
  executables:
@@ -33,6 +33,7 @@ files:
33
33
  - lib/sawara/config.rb
34
34
  - lib/sawara/talk.rb
35
35
  - lib/sawara/version.rb
36
+ - sawara.gemspec
36
37
  - sig/chatgpt_cli.rbs
37
38
  homepage: https://github.com/yocajii/sawara
38
39
  licenses: