Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ jobs:
ci:
runs-on: ubuntu-latest
name: RSpec and Rubocop
strategy:
matrix:
ruby: ['3.4', '4.0']
timeout-minutes: 3
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby_version }}
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run rspec
run: bundle exec rspec
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 3.2
TargetRubyVersion: 4.0
NewCops: enable

inherit_gem:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.4.7
4.0.7
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ group :development do
end

group :development, :test do
gem "foobara-anthropic-api", "< 2.0.0"
# one test fails on the newly released foobara-anthropic-api 1.0.6
# related to `temperature` no longer being an allowed attribute
gem "foobara-anthropic-api", "1.0.5"
gem "foobara-ollama-api", "< 2.0.0"
gem "foobara-open-ai-api", "< 2.0.0"

Expand Down
150 changes: 75 additions & 75 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,31 @@ PATH
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.8)
addressable (2.9.0)
public_suffix (>= 2.0.2, < 8.0)
ast (2.4.3)
base64 (0.3.0)
bigdecimal (4.0.1)
byebug (12.0.0)
bigdecimal (4.1.3)
byebug (13.0.0)
reline (>= 0.6.0)
coderay (1.1.3)
crack (1.0.1)
bigdecimal
rexml
date (3.5.1)
diff-lcs (1.6.2)
docile (1.4.1)
dotenv (3.2.0)
erb (6.0.1)
ffi (1.17.3-aarch64-linux-gnu)
ffi (1.17.3-aarch64-linux-musl)
ffi (1.17.3-arm-linux-gnu)
ffi (1.17.3-arm-linux-musl)
ffi (1.17.3-arm64-darwin)
ffi (1.17.3-x86-linux-gnu)
ffi (1.17.3-x86-linux-musl)
ffi (1.17.3-x86_64-darwin)
ffi (1.17.3-x86_64-linux-gnu)
ffi (1.17.3-x86_64-linux-musl)
foobara (0.4.1)
erb (6.0.7)
ffi (1.17.4-aarch64-linux-gnu)
ffi (1.17.4-aarch64-linux-musl)
ffi (1.17.4-arm-linux-gnu)
ffi (1.17.4-arm-linux-musl)
ffi (1.17.4-arm64-darwin)
ffi (1.17.4-x86-linux-gnu)
ffi (1.17.4-x86-linux-musl)
ffi (1.17.4-x86_64-darwin)
ffi (1.17.4-x86_64-linux-gnu)
ffi (1.17.4-x86_64-linux-musl)
foobara (0.6.4)
bigdecimal
foobara-lru-cache (< 2.0.0)
foobara-util (< 2.0.0)
Expand All @@ -45,42 +44,42 @@ GEM
foobara (>= 0.4.1, < 2.0.0)
foobara-cached-command (< 2.0.0)
foobara-http-api-command (< 2.0.0)
foobara-cached-command (1.0.0)
foobara (< 2.0.0)
foobara-cached-command (1.0.1)
foobara (>= 0.1.1, < 2.0.0)
foobara-dotenv-loader (0.0.3)
dotenv
foobara-http-api-command (0.0.9)
foobara
foobara-json-schema-generator (1.1.0)
foobara-json-schema-generator (1.1.1)
foobara (>= 0.1.1, < 2.0.0)
foobara-llm-backed-command (1.0.3)
foobara (>= 0.1.1, < 2.0.0)
foobara-llm-backed-command (1.0.2)
foobara (>= 0.0.136, < 2.0.0)
foobara-ai (>= 1.0.0, < 2.0.0)
foobara-json-schema-generator (>= 1.0.0, < 2.0.0)
foobara-lru-cache (1.0.0)
foobara-ollama-api (1.0.3)
foobara (>= 0.1.1, < 2.0.0)
foobara-cached-command (>= 1.0.0, < 2.0.0)
foobara-http-api-command (< 2.0.0)
foobara-open-ai-api (1.0.1)
foobara-cached-command
foobara-http-api-command
foobara-rubocop-rules (1.0.10)
foobara-open-ai-api (1.0.2)
foobara (>= 0.6.4, < 2.0.0)
foobara-cached-command (< 2.0.0)
foobara-http-api-command (< 2.0.0)
foobara-rubocop-rules (1.1.1)
rubocop
rubocop-rspec
foobara-spec-helpers (0.0.4)
foobara-spec-helpers (0.1.1)
foobara-util
foobara-util (1.0.7)
foobara-util (1.0.8)
formatador (1.2.3)
reline
guard (2.19.1)
guard (2.20.2)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
logger (~> 1.6)
lumberjack (>= 1.0.12, < 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
ostruct (~> 0.6)
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
Expand All @@ -91,15 +90,17 @@ GEM
rspec (>= 2.99.0, < 4.0)
hashdiff (1.2.1)
inheritable-thread-vars (0.0.3)
io-console (0.8.2)
irb (1.16.0)
io-console (0.9.4)
irb (1.18.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.18.0)
language_server-protocol (3.17.0.5)
json (3.0.2)
language_server-protocol (3.17.0.6)
lint_roller (1.1.0)
listen (3.9.0)
listen (3.10.0)
logger
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.7.0)
Expand All @@ -110,36 +111,39 @@ GEM
nenv (~> 0.1)
shellany (~> 0.0)
ostruct (0.6.3)
parallel (1.27.0)
parser (3.3.10.0)
parallel (2.2.0)
parser (3.3.12.0)
ast (~> 2.4.1)
racc
pp (0.6.3)
pp (0.6.4)
prettyprint
prettyprint (0.2.0)
prism (1.7.0)
pry (0.15.2)
prism (1.9.0)
pry (0.16.0)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.11.0)
byebug (~> 12.0)
pry (>= 0.13, < 0.16)
psych (5.3.1)
date
stringio
public_suffix (7.0.0)
reline (>= 0.6.0)
pry-byebug (3.12.0)
byebug (~> 13.0)
pry (>= 0.13, < 0.17)
public_suffix (7.0.5)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
rake (13.4.2)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rdoc (7.0.3)
rbs (4.2.0)
logger
prism (>= 1.6.0)
tsort
rdoc (8.0.0)
erb
psych (>= 4.0.0)
prism (>= 1.6.0)
rbs (>= 4.0.0)
tsort
regexp_parser (2.11.3)
reline (0.6.3)
regexp_parser (2.13.0)
reline (0.7.0)
io-console (~> 0.5)
rexml (3.4.4)
rspec (3.13.2)
Expand All @@ -154,48 +158,44 @@ GEM
rspec-its (2.0.0)
rspec-core (>= 3.13.0)
rspec-expectations (>= 3.13.0)
rspec-mocks (3.13.7)
rspec-mocks (3.13.8)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.6)
rubocop (1.82.1)
json (~> 2.3)
rspec-support (3.13.7)
rubocop (1.91.0)
json (>= 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parallel (>= 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.48.0, < 2.0)
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.49.0)
rubocop-ast (1.50.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
rubocop-rake (0.7.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-rspec (3.8.0)
rubocop-rspec (3.10.2)
lint_roller (~> 1.1)
rubocop (~> 1.81)
ruby-prof (1.7.2)
regexp_parser (>= 2.0)
rubocop (~> 1.86, >= 1.86.2)
ruby-prof (2.0.5)
base64
ostruct
ruby-progressbar (1.13.0)
shellany (0.0.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.2)
simplecov_json_formatter (0.1.4)
stringio (3.2.0)
thor (1.4.0)
simplecov (1.3.0)
thor (1.5.0)
tsort (0.2.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.2.0)
unicode-display_width (3.3.0)
unicode-emoji (~> 4.3)
unicode-emoji (4.3.0)
vcr (6.4.0)
webmock (3.26.1)
webmock (3.26.4)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -214,7 +214,7 @@ PLATFORMS

DEPENDENCIES
foobara-agent-cli!
foobara-anthropic-api (< 2.0.0)
foobara-anthropic-api (= 1.0.5)
foobara-dotenv-loader (< 2.0.0)
foobara-ollama-api (< 2.0.0)
foobara-open-ai-api (< 2.0.0)
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "pry"
require "pry-byebug"
require "rspec/its"
Warning[:deprecated] = true

require_relative "support/simplecov"
require_relative "../boot/start"
Expand Down
2 changes: 1 addition & 1 deletion spec/support/simplecov.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "simplecov"

SimpleCov.start do
add_filter "spec/"
skip "spec/"
# enable_coverage :branch
minimum_coverage line: 100
# TODO: enable this? worth it to get to 100% branch coverage?
Expand Down
12 changes: 6 additions & 6 deletions src/foobara/cli_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ def run
print_outcome(outcome)
print_prompt
rescue => e
# :nocov:
# simplecov:disable
Util.pipe_writeline(io_err, e.message)
Util.pipe_writeline(io_err, e.backtrace)
# :nocov:
# simplecov:enable
end
end
end

def print_welcome_message
welcome_message = if agent_name
"Welcome! I am #{agent_name}!"
+"Welcome! I am #{agent_name}!"
else
"Welcome to the Foobara Agent CLI!"
+"Welcome to the Foobara Agent CLI!"
end

welcome_message << " What would you like me to attempt to accomplish?"
Expand All @@ -70,9 +70,9 @@ def print_outcome(outcome)
message, stream = if outcome.success?
[outcome.result[:message_to_user], io_out]
else
# :nocov:
# simplecov:disable
["ERROR: #{outcome.errors_hash}", io_err]
# :nocov:
# simplecov:enable
end

print_agent_message(message, stream)
Expand Down
12 changes: 6 additions & 6 deletions src/foobara/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ def pipe_wait_readable(io, timeout = nil)
def pipe_io_operation(_io)
yield
rescue EOFError
# :nocov:
# simplecov:disable
nil
# :nocov:
# simplecov:enable
rescue IOError => e
# :nocov:
# simplecov:disable
message = e.message

if message.include?("closed") && message.include?("stream")
nil
else
raise
end
# :nocov:
# simplecov:enable
end

def close(io)
io.close
nil
rescue IOError
# :nocov:
# simplecov:disable
nil
# :nocov:
# simplecov:enable
end
end
end
Loading