roast-ai 0.4.9 → 0.4.10

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -7
  3. data/Gemfile.lock +14 -2
  4. data/dsl/demo/Gemfile +4 -0
  5. data/dsl/demo/Gemfile.lock +120 -0
  6. data/dsl/demo/cogs/local.rb +15 -0
  7. data/dsl/demo/simple_external_cog.rb +17 -0
  8. data/dsl/plugin-gem-example/.gitignore +8 -0
  9. data/dsl/plugin-gem-example/Gemfile +13 -0
  10. data/dsl/plugin-gem-example/Gemfile.lock +178 -0
  11. data/dsl/plugin-gem-example/lib/other.rb +17 -0
  12. data/dsl/plugin-gem-example/lib/plugin_gem_example.rb +5 -0
  13. data/dsl/plugin-gem-example/lib/simple.rb +15 -0
  14. data/dsl/plugin-gem-example/lib/version.rb +10 -0
  15. data/dsl/plugin-gem-example/plugin-gem-example.gemspec +28 -0
  16. data/dsl/prototype.rb +11 -3
  17. data/dsl/scoped_executors.rb +28 -0
  18. data/dsl/simple_chat.rb +12 -0
  19. data/dsl/step_communication.rb +10 -4
  20. data/lib/roast/dsl/cog/config.rb +6 -1
  21. data/lib/roast/dsl/cog/input.rb +30 -0
  22. data/lib/roast/dsl/cog/output.rb +24 -0
  23. data/lib/roast/dsl/cog/registry.rb +39 -0
  24. data/lib/roast/dsl/cog/stack.rb +2 -1
  25. data/lib/roast/dsl/cog/store.rb +8 -5
  26. data/lib/roast/dsl/cog.rb +49 -28
  27. data/lib/roast/dsl/cog_input_context.rb +9 -0
  28. data/lib/roast/dsl/cog_input_manager.rb +47 -0
  29. data/lib/roast/dsl/cogs/chat.rb +78 -0
  30. data/lib/roast/dsl/cogs/cmd.rb +97 -20
  31. data/lib/roast/dsl/cogs/execute.rb +46 -0
  32. data/lib/roast/dsl/cogs/graph.rb +3 -3
  33. data/lib/roast/dsl/config_context.rb +2 -47
  34. data/lib/roast/dsl/config_manager.rb +96 -0
  35. data/lib/roast/dsl/execution_context.rb +9 -0
  36. data/lib/roast/dsl/execution_manager.rb +137 -0
  37. data/lib/roast/dsl/workflow.rb +113 -0
  38. data/lib/roast/version.rb +1 -1
  39. data/lib/roast.rb +3 -2
  40. data/roast.gemspec +1 -0
  41. data/sorbet/config +1 -0
  42. data/sorbet/rbi/gems/marcel@1.1.0.rbi +239 -0
  43. data/sorbet/rbi/gems/{rack@2.2.18.rbi → rack@2.2.19.rbi} +55 -38
  44. data/sorbet/rbi/gems/ruby_llm@1.8.2.rbi +5703 -0
  45. data/sorbet/rbi/shims/lib/roast/dsl/cog_input_context.rbi +17 -0
  46. data/sorbet/rbi/shims/lib/roast/dsl/config_context.rbi +6 -0
  47. data/sorbet/rbi/shims/lib/roast/dsl/execution_context.rbi +17 -0
  48. metadata +45 -8
  49. data/lib/roast/dsl/cog_execution_context.rb +0 -29
  50. data/lib/roast/dsl/cogs.rb +0 -65
  51. data/lib/roast/dsl/executor.rb +0 -82
  52. data/lib/roast/dsl/workflow_execution_context.rb +0 -47
  53. data/sorbet/rbi/gems/rbs-inline@0.12.0.rbi +0 -2170
  54. data/sorbet/rbi/shims/lib/roast/dsl/workflow_execution_context.rbi +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc01ff6a90dbe17c735b17935bb75bcfda0ee47c0b9dbee6234292cc4f5f3799
4
- data.tar.gz: caa21e581b5476a65c2dc8b0b7a27f1b20baf2f493260d954785724f73a3ff40
3
+ metadata.gz: ef6e5b6234cde031dbec2498a1edfe20822de1afb336292ff0e55d3abada5748
4
+ data.tar.gz: 26992714777862482a9935b7b924f7064db3eed24d3fb25b18b21ef7b741385c
5
5
  SHA512:
6
- metadata.gz: 6ea65bb2381627119b5740f9353b064d046e26b2769e0be36baf3f13b9696e30e6bd6332fbbf8c4305fea33d1b2bb12d81a4a56871f3793c3718e2ac8407c6ae
7
- data.tar.gz: 23ff60c01817d64bae76bb16c0395d8cc7aa95cd621550cebc5fc6763fcf5ba8a023542bf07b49067fa9210d8f228f538b0e82159d897397d08532deece73bc4
6
+ metadata.gz: 4dc6d30fa71c300fb83ae5144e6fbd55ab7770b25534daa6dadc24c58484276d590951840d196b074038328db317adda90c885d3f6779cfadc0125348e40cf23
7
+ data.tar.gz: 0d35f0494140641ec3c2a643e86f4b6b174adbbf44af866d617471c405b0247f51a45f53514488a28b4dbd6b0175ff87521752ffba663ab926e51259b7398eeb
data/Gemfile CHANGED
@@ -8,20 +8,19 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
8
8
  gemspec
9
9
 
10
10
  gem "cgi"
11
+ gem "claude_swarm"
11
12
  gem "cli-ui", "2.3.0"
12
13
  gem "dotenv"
13
- gem "guard"
14
14
  gem "guard-minitest"
15
+ gem "guard"
16
+ gem "minitest-rg"
15
17
  gem "mocha"
16
18
  gem "rake", require: false
17
19
  gem "rubocop-shopify", require: false
18
20
  gem "rubocop-sorbet", require: false
21
+ gem "ruby_llm"
19
22
  gem "simplecov", require: false
20
- gem "minitest-rg"
21
- gem "vcr", require: false
22
- gem "webmock", require: false
23
-
24
23
  gem "sorbet", require: false
25
24
  gem "tapioca", require: false
26
-
27
- gem "claude_swarm"
25
+ gem "vcr", require: false
26
+ gem "webmock", require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roast-ai (0.4.9)
4
+ roast-ai (0.4.10)
5
5
  activesupport (>= 7.0)
6
6
  cli-kit (~> 5.0)
7
7
  cli-ui (= 2.3.0)
@@ -10,6 +10,7 @@ PATH
10
10
  open_router (~> 0.3)
11
11
  raix (~> 1.0.2)
12
12
  ruby-graphviz (~> 1.2)
13
+ ruby_llm
13
14
  sqlite3 (~> 2.6)
14
15
  thor (~> 1.3)
15
16
  zeitwerk (~> 2.6)
@@ -133,6 +134,7 @@ GEM
133
134
  rb-inotify (~> 0.9, >= 0.9.10)
134
135
  logger (1.7.0)
135
136
  lumberjack (1.2.10)
137
+ marcel (1.1.0)
136
138
  method_source (1.1.0)
137
139
  mime-types (3.7.0)
138
140
  logger
@@ -167,7 +169,7 @@ GEM
167
169
  method_source (~> 1.0)
168
170
  public_suffix (6.0.2)
169
171
  racc (1.8.1)
170
- rack (2.2.19)
172
+ rack (2.2.20)
171
173
  rainbow (3.1.1)
172
174
  raix (1.0.2)
173
175
  activesupport (>= 6.0)
@@ -213,6 +215,15 @@ GEM
213
215
  faraday-multipart (>= 1)
214
216
  ruby-progressbar (1.13.0)
215
217
  ruby2_keywords (0.0.5)
218
+ ruby_llm (1.8.2)
219
+ base64
220
+ event_stream_parser (~> 1)
221
+ faraday (>= 1.10.0)
222
+ faraday-multipart (>= 1)
223
+ faraday-net_http (>= 1)
224
+ faraday-retry (>= 1)
225
+ marcel (~> 1.0)
226
+ zeitwerk (~> 2)
216
227
  securerandom (0.4.1)
217
228
  shellany (0.0.1)
218
229
  simplecov (0.22.0)
@@ -284,6 +295,7 @@ DEPENDENCIES
284
295
  roast-ai!
285
296
  rubocop-shopify
286
297
  rubocop-sorbet
298
+ ruby_llm
287
299
  simplecov
288
300
  sorbet
289
301
  tapioca
data/dsl/demo/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ gem "roast-ai", path: "../.."
4
+ gem "plugin-gem-example", path: "../plugin-gem-example"
@@ -0,0 +1,120 @@
1
+ PATH
2
+ remote: ../..
3
+ specs:
4
+ roast-ai (0.4.9)
5
+ activesupport (>= 7.0)
6
+ cli-kit (~> 5.0)
7
+ cli-ui (= 2.3.0)
8
+ diff-lcs (~> 1.5)
9
+ json-schema
10
+ open_router (~> 0.3)
11
+ raix (~> 1.0.2)
12
+ ruby-graphviz (~> 1.2)
13
+ ruby_llm
14
+ sqlite3 (~> 2.6)
15
+ thor (~> 1.3)
16
+ zeitwerk (~> 2.6)
17
+
18
+ PATH
19
+ remote: ../plugin-gem-example
20
+ specs:
21
+ plugin-gem-example (0.1.0)
22
+ roast-ai
23
+
24
+ GEM
25
+ specs:
26
+ activesupport (8.0.3)
27
+ base64
28
+ benchmark (>= 0.3)
29
+ bigdecimal
30
+ concurrent-ruby (~> 1.0, >= 1.3.1)
31
+ connection_pool (>= 2.2.5)
32
+ drb
33
+ i18n (>= 1.6, < 2)
34
+ logger (>= 1.4.2)
35
+ minitest (>= 5.1)
36
+ securerandom (>= 0.3)
37
+ tzinfo (~> 2.0, >= 2.0.5)
38
+ uri (>= 0.13.1)
39
+ addressable (2.8.7)
40
+ public_suffix (>= 2.0.2, < 7.0)
41
+ base64 (0.3.0)
42
+ benchmark (0.4.1)
43
+ bigdecimal (3.3.1)
44
+ cli-kit (5.0.1)
45
+ cli-ui (~> 2.0)
46
+ cli-ui (2.3.0)
47
+ concurrent-ruby (1.3.5)
48
+ connection_pool (2.5.4)
49
+ diff-lcs (1.6.2)
50
+ dotenv (3.1.8)
51
+ drb (2.2.3)
52
+ event_stream_parser (1.0.0)
53
+ faraday (2.14.0)
54
+ faraday-net_http (>= 2.0, < 3.5)
55
+ json
56
+ logger
57
+ faraday-multipart (1.1.1)
58
+ multipart-post (~> 2.0)
59
+ faraday-net_http (3.4.1)
60
+ net-http (>= 0.5.0)
61
+ faraday-retry (2.3.2)
62
+ faraday (~> 2.0)
63
+ i18n (1.14.7)
64
+ concurrent-ruby (~> 1.0)
65
+ json (2.15.1)
66
+ json-schema (6.0.0)
67
+ addressable (~> 2.8)
68
+ bigdecimal (~> 3.1)
69
+ logger (1.7.0)
70
+ marcel (1.1.0)
71
+ minitest (5.26.0)
72
+ multipart-post (2.4.1)
73
+ net-http (0.6.0)
74
+ uri
75
+ open_router (0.3.3)
76
+ activesupport (>= 6.0)
77
+ dotenv (>= 2)
78
+ faraday (>= 1)
79
+ faraday-multipart (>= 1)
80
+ ostruct (0.6.3)
81
+ public_suffix (6.0.2)
82
+ raix (1.0.3)
83
+ activesupport (>= 6.0)
84
+ faraday-retry (~> 2.0)
85
+ open_router (~> 0.2)
86
+ ostruct
87
+ ruby-openai (~> 8.1)
88
+ rexml (3.4.4)
89
+ ruby-graphviz (1.2.5)
90
+ rexml
91
+ ruby-openai (8.3.0)
92
+ event_stream_parser (>= 0.3.0, < 2.0.0)
93
+ faraday (>= 1)
94
+ faraday-multipart (>= 1)
95
+ ruby_llm (1.8.2)
96
+ base64
97
+ event_stream_parser (~> 1)
98
+ faraday (>= 1.10.0)
99
+ faraday-multipart (>= 1)
100
+ faraday-net_http (>= 1)
101
+ faraday-retry (>= 1)
102
+ marcel (~> 1.0)
103
+ zeitwerk (~> 2)
104
+ securerandom (0.4.1)
105
+ sqlite3 (2.7.4-arm64-darwin)
106
+ thor (1.4.0)
107
+ tzinfo (2.0.6)
108
+ concurrent-ruby (~> 1.0)
109
+ uri (1.0.4)
110
+ zeitwerk (2.7.3)
111
+
112
+ PLATFORMS
113
+ arm64-darwin
114
+
115
+ DEPENDENCIES
116
+ plugin-gem-example!
117
+ roast-ai!
118
+
119
+ BUNDLED WITH
120
+ 2.6.8
@@ -0,0 +1,15 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ class Local < Roast::DSL::Cog
5
+ class Input < Roast::DSL::Cog::Input
6
+ def validate!
7
+ true
8
+ end
9
+ end
10
+
11
+ #: (Input) -> void
12
+ def execute(input)
13
+ puts "I'm a workflow-specific cog!"
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ #: self as Roast::DSL::Workflow
5
+
6
+ use "simple", from: "plugin_gem_example"
7
+ use "MyCogNamespace::Other", from: "plugin_gem_example"
8
+ use "local"
9
+
10
+ # Use multiple cogs
11
+ # use ["simple", "other"], from: "plugin_gem_example"
12
+
13
+ execute do
14
+ simple
15
+ other
16
+ local
17
+ end
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in plugin-gem-example.gemspec
6
+ gemspec
7
+
8
+ gem "irb"
9
+ gem "rake", "~> 13.0"
10
+
11
+ gem "minitest", "~> 5.16"
12
+
13
+ gem "rubocop", "~> 1.21"
@@ -0,0 +1,178 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ plugin-gem-example (0.1.0)
5
+ roast-ai
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activesupport (8.0.3)
11
+ base64
12
+ benchmark (>= 0.3)
13
+ bigdecimal
14
+ concurrent-ruby (~> 1.0, >= 1.3.1)
15
+ connection_pool (>= 2.2.5)
16
+ drb
17
+ i18n (>= 1.6, < 2)
18
+ logger (>= 1.4.2)
19
+ minitest (>= 5.1)
20
+ securerandom (>= 0.3)
21
+ tzinfo (~> 2.0, >= 2.0.5)
22
+ uri (>= 0.13.1)
23
+ addressable (2.8.7)
24
+ public_suffix (>= 2.0.2, < 7.0)
25
+ ast (2.4.3)
26
+ base64 (0.3.0)
27
+ benchmark (0.4.1)
28
+ bigdecimal (3.3.1)
29
+ cli-kit (5.0.1)
30
+ cli-ui (~> 2.0)
31
+ cli-ui (2.3.0)
32
+ concurrent-ruby (1.3.5)
33
+ connection_pool (2.5.4)
34
+ date (3.4.1)
35
+ diff-lcs (1.6.2)
36
+ dotenv (3.1.8)
37
+ drb (2.2.3)
38
+ erb (5.1.1)
39
+ event_stream_parser (1.0.0)
40
+ faraday (2.14.0)
41
+ faraday-net_http (>= 2.0, < 3.5)
42
+ json
43
+ logger
44
+ faraday-multipart (1.1.1)
45
+ multipart-post (~> 2.0)
46
+ faraday-net_http (3.4.1)
47
+ net-http (>= 0.5.0)
48
+ faraday-retry (2.3.2)
49
+ faraday (~> 2.0)
50
+ i18n (1.14.7)
51
+ concurrent-ruby (~> 1.0)
52
+ io-console (0.8.1)
53
+ irb (1.15.2)
54
+ pp (>= 0.6.0)
55
+ rdoc (>= 4.0.0)
56
+ reline (>= 0.4.2)
57
+ json (2.15.1)
58
+ json-schema (6.0.0)
59
+ addressable (~> 2.8)
60
+ bigdecimal (~> 3.1)
61
+ language_server-protocol (3.17.0.5)
62
+ lint_roller (1.1.0)
63
+ logger (1.7.0)
64
+ minitest (5.26.0)
65
+ multipart-post (2.4.1)
66
+ net-http (0.6.0)
67
+ uri
68
+ open_router (0.3.3)
69
+ activesupport (>= 6.0)
70
+ dotenv (>= 2)
71
+ faraday (>= 1)
72
+ faraday-multipart (>= 1)
73
+ ostruct (0.6.3)
74
+ parallel (1.27.0)
75
+ parser (3.3.9.0)
76
+ ast (~> 2.4.1)
77
+ racc
78
+ pp (0.6.3)
79
+ prettyprint
80
+ prettyprint (0.2.0)
81
+ prism (1.6.0)
82
+ psych (5.2.6)
83
+ date
84
+ stringio
85
+ public_suffix (6.0.2)
86
+ racc (1.8.1)
87
+ rainbow (3.1.1)
88
+ raix (1.0.3)
89
+ activesupport (>= 6.0)
90
+ faraday-retry (~> 2.0)
91
+ open_router (~> 0.2)
92
+ ostruct
93
+ ruby-openai (~> 8.1)
94
+ rake (13.3.0)
95
+ rdoc (6.15.0)
96
+ erb
97
+ psych (>= 4.0.0)
98
+ tsort
99
+ regexp_parser (2.11.3)
100
+ reline (0.6.2)
101
+ io-console (~> 0.5)
102
+ rexml (3.4.4)
103
+ roast-ai (0.4.9)
104
+ activesupport (>= 7.0)
105
+ cli-kit (~> 5.0)
106
+ cli-ui (= 2.3.0)
107
+ diff-lcs (~> 1.5)
108
+ json-schema
109
+ open_router (~> 0.3)
110
+ raix (~> 1.0.2)
111
+ ruby-graphviz (~> 1.2)
112
+ sqlite3 (~> 2.6)
113
+ thor (~> 1.3)
114
+ zeitwerk (~> 2.6)
115
+ rubocop (1.81.1)
116
+ json (~> 2.3)
117
+ language_server-protocol (~> 3.17.0.2)
118
+ lint_roller (~> 1.1.0)
119
+ parallel (~> 1.10)
120
+ parser (>= 3.3.0.2)
121
+ rainbow (>= 2.2.2, < 4.0)
122
+ regexp_parser (>= 2.9.3, < 3.0)
123
+ rubocop-ast (>= 1.47.1, < 2.0)
124
+ ruby-progressbar (~> 1.7)
125
+ unicode-display_width (>= 2.4.0, < 4.0)
126
+ rubocop-ast (1.47.1)
127
+ parser (>= 3.3.7.2)
128
+ prism (~> 1.4)
129
+ ruby-graphviz (1.2.5)
130
+ rexml
131
+ ruby-openai (8.3.0)
132
+ event_stream_parser (>= 0.3.0, < 2.0.0)
133
+ faraday (>= 1)
134
+ faraday-multipart (>= 1)
135
+ ruby-progressbar (1.13.0)
136
+ securerandom (0.4.1)
137
+ sqlite3 (2.7.4-aarch64-linux-gnu)
138
+ sqlite3 (2.7.4-aarch64-linux-musl)
139
+ sqlite3 (2.7.4-arm-linux-gnu)
140
+ sqlite3 (2.7.4-arm-linux-musl)
141
+ sqlite3 (2.7.4-arm64-darwin)
142
+ sqlite3 (2.7.4-x86-linux-gnu)
143
+ sqlite3 (2.7.4-x86-linux-musl)
144
+ sqlite3 (2.7.4-x86_64-darwin)
145
+ sqlite3 (2.7.4-x86_64-linux-gnu)
146
+ sqlite3 (2.7.4-x86_64-linux-musl)
147
+ stringio (3.1.7)
148
+ thor (1.4.0)
149
+ tsort (0.2.0)
150
+ tzinfo (2.0.6)
151
+ concurrent-ruby (~> 1.0)
152
+ unicode-display_width (3.2.0)
153
+ unicode-emoji (~> 4.1)
154
+ unicode-emoji (4.1.0)
155
+ uri (1.0.4)
156
+ zeitwerk (2.7.3)
157
+
158
+ PLATFORMS
159
+ aarch64-linux-gnu
160
+ aarch64-linux-musl
161
+ arm-linux-gnu
162
+ arm-linux-musl
163
+ arm64-darwin
164
+ x86-linux-gnu
165
+ x86-linux-musl
166
+ x86_64-darwin
167
+ x86_64-linux-gnu
168
+ x86_64-linux-musl
169
+
170
+ DEPENDENCIES
171
+ irb
172
+ minitest (~> 5.16)
173
+ plugin-gem-example!
174
+ rake (~> 13.0)
175
+ rubocop (~> 1.21)
176
+
177
+ BUNDLED WITH
178
+ 2.6.8
@@ -0,0 +1,17 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module MyCogNamespace
5
+ class Other < Roast::DSL::Cog
6
+ class Input < Roast::DSL::Cog::Input
7
+ def validate!
8
+ true
9
+ end
10
+ end
11
+
12
+ #: (Input) -> void
13
+ def execute(input)
14
+ puts "I'm a different cog!"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require "simple"
5
+ require "other"
@@ -0,0 +1,15 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ class Simple < Roast::DSL::Cog
5
+ class Input < Roast::DSL::Cog::Input
6
+ def validate!
7
+ true
8
+ end
9
+ end
10
+
11
+ #: (Input) -> void
12
+ def execute(input)
13
+ puts "I'm a cog!"
14
+ end
15
+ end
@@ -0,0 +1,10 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module Plugin
5
+ module Gem
6
+ module Example
7
+ VERSION = "0.1.0"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "plugin-gem-example"
7
+ spec.version = Plugin::Gem::Example::VERSION
8
+ spec.authors = ["Sam Schmidt"]
9
+ spec.email = ["sam.schmidt@shopify.com"]
10
+
11
+ spec.summary = "TODO: Write a short summary, because RubyGems requires one."
12
+ spec.description = "TODO: Write a longer description or delete this line."
13
+ spec.homepage = "TODO: Put your gem's website or public repo URL here."
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = ">= 3.1.0"
16
+
17
+ spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
21
+ spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+
23
+ # Uncomment to register a new dependency of your gem
24
+ spec.add_dependency("roast-ai")
25
+
26
+ # For more information and examples about making a new gem, check out our
27
+ # guide at: https://bundler.io/guides/creating_gem.html
28
+ end
data/dsl/prototype.rb CHANGED
@@ -1,17 +1,25 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- #: self as Roast::DSL::Executor
4
+ #: self as Roast::DSL::Workflow
5
5
 
6
6
  config do
7
+ # TODO: make a way to do print_all on all and turn off printing on one
7
8
  cmd(:echo) { print_all! }
9
+ cmd(:date) { print_stdout! }
10
+ chat { "" }
11
+ # TODO: add a way to apply config to a subset of named cog by pattern
12
+ # cmd(/^date.*/) { print_all! }
8
13
  end
9
14
 
10
15
  execute do
11
16
  # Anonymous cog. Added to the stack directly and given an autogenerated key in cog storage
12
17
  # Use for actions you do once and forget about, don't need configuration
13
- cmd { "touch tmp/#{SecureRandom.uuid} " }
18
+ cmd { |my| my.command = "touch tmp/#{SecureRandom.uuid}" }
14
19
 
15
20
  # Named cog. Configuration for this specific instance will be looked up from config block
16
- cmd(:echo) { "echo 'Hello World!'" }
21
+ cmd(:echo) { |my| my.command = "echo 'Hello World!'" }
22
+
23
+ # Cogs can implement input coercion for simple return values
24
+ cmd(:date) { "date" }
17
25
  end
@@ -0,0 +1,28 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ #: self as Roast::DSL::Workflow
5
+
6
+ config do
7
+ cmd do
8
+ print_all!
9
+ end
10
+ end
11
+
12
+ execute(:capitalize_a_random_word) do
13
+ cmd(:word) { "shuf /usr/share/dict/words -n 1" }
14
+ cmd(:capitalize) do |my|
15
+ word = cmd(:word).out.strip
16
+ my.command = "sh"
17
+ my.args << "-c"
18
+ my.args << "echo '#{word}' | tr '[:lower:]' '[:upper:]'"
19
+ end
20
+ end
21
+
22
+ execute do
23
+ cmd(:before) { "echo '--> before'" }
24
+ execute { :capitalize_a_random_word }
25
+ execute { :capitalize_a_random_word }
26
+ execute { :capitalize_a_random_word }
27
+ cmd(:after) { "echo '--> after'" }
28
+ end
@@ -0,0 +1,12 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ #: self as Roast::DSL::Workflow
5
+
6
+ config do
7
+ # ...
8
+ end
9
+
10
+ execute do
11
+ chat(:lake) { "What is the deepest lake?" }
12
+ end
@@ -1,6 +1,8 @@
1
- # typed: false
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
+ #: self as Roast::DSL::Workflow
5
+
4
6
  # How do we pass information between steps?
5
7
  # Demonstrate by passing result of a command output to another step
6
8
 
@@ -10,9 +12,13 @@ end
10
12
 
11
13
  execute do
12
14
  cmd(:ls) { "ls -al" }
13
- cmd(:echo) do
15
+ cmd(:echo) do |my|
16
+ my.command = "echo"
14
17
  # TODO: this is a bespoke output object for cmd, is there a generic one we can offer
15
- first_line = cmd(:ls).command_output.split("\n").second
16
- "echo '#{first_line}'"
18
+ first_line = cmd(:ls).out.split("\n").second
19
+ last_line = cmd(:ls).out.split("\n").last
20
+ my.args << first_line unless first_line.blank?
21
+ my.args << "\n---\n"
22
+ my.args << last_line if last_line != first_line && last_line.present?
17
23
  end
18
24
  end
@@ -1,16 +1,19 @@
1
- # typed: false
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Roast
5
5
  module DSL
6
6
  class Cog
7
7
  class Config
8
+ #: Hash[Symbol, untyped]
8
9
  attr_reader :values
9
10
 
11
+ #: (?Hash[Symbol, untyped]) -> void
10
12
  def initialize(initial = {})
11
13
  @values = initial
12
14
  end
13
15
 
16
+ #: (Cog::Config) -> Cog::Config
14
17
  def merge(config_object)
15
18
  self.class.new(values.merge(config_object.values))
16
19
  end
@@ -18,10 +21,12 @@ module Roast
18
21
  # It is recommended to implement a custom config object for a nicer interface,
19
22
  # but for simple cases where it would just be a key value store we provide one by default.
20
23
 
24
+ #: (Symbol, untyped) -> void
21
25
  def []=(key, value)
22
26
  @values[key] = value
23
27
  end
24
28
 
29
+ #: (Symbol) -> untyped
25
30
  def [](key)
26
31
  @values[key]
27
32
  end