roast-ai 0.4.10 → 0.5.0

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 (173) hide show
  1. checksums.yaml +4 -4
  2. data/.claude/commands/docs/write-comments.md +36 -0
  3. data/.github/CODEOWNERS +1 -1
  4. data/.github/workflows/ci.yaml +10 -6
  5. data/.gitignore +0 -1
  6. data/.rubocop.yml +7 -1
  7. data/CLAUDE.md +2 -2
  8. data/CONTRIBUTING.md +2 -0
  9. data/Gemfile +19 -18
  10. data/Gemfile.lock +35 -58
  11. data/README.md +118 -1432
  12. data/README_LEGACY.md +1464 -0
  13. data/Rakefile +39 -4
  14. data/dev.yml +29 -0
  15. data/dsl/agent_sessions.rb +20 -0
  16. data/dsl/async_cogs.rb +49 -0
  17. data/dsl/async_cogs_complex.rb +67 -0
  18. data/dsl/call.rb +44 -0
  19. data/dsl/collect_from.rb +72 -0
  20. data/dsl/json_output.rb +28 -0
  21. data/dsl/map.rb +55 -0
  22. data/dsl/map_reduce.rb +37 -0
  23. data/dsl/map_with_index.rb +49 -0
  24. data/dsl/next_break.rb +40 -0
  25. data/dsl/next_break_parallel.rb +44 -0
  26. data/dsl/outputs.rb +39 -0
  27. data/dsl/outputs_bang.rb +36 -0
  28. data/dsl/parallel_map.rb +37 -0
  29. data/dsl/prompts/simple_prompt.md.erb +3 -0
  30. data/dsl/prototype.rb +5 -7
  31. data/dsl/repeat_loop_results.rb +53 -0
  32. data/dsl/ruby_cog.rb +72 -0
  33. data/dsl/simple_agent.rb +18 -0
  34. data/dsl/simple_chat.rb +15 -1
  35. data/dsl/simple_repeat.rb +29 -0
  36. data/dsl/skip.rb +36 -0
  37. data/dsl/step_communication.rb +2 -3
  38. data/dsl/targets_and_params.rb +57 -0
  39. data/dsl/temperature.rb +17 -0
  40. data/dsl/temporary_directory.rb +22 -0
  41. data/dsl/tutorial/01_your_first_workflow/README.md +179 -0
  42. data/dsl/tutorial/01_your_first_workflow/configured_chat.rb +33 -0
  43. data/dsl/tutorial/01_your_first_workflow/hello.rb +23 -0
  44. data/dsl/tutorial/02_chaining_cogs/README.md +310 -0
  45. data/dsl/tutorial/02_chaining_cogs/code_review.rb +104 -0
  46. data/dsl/tutorial/02_chaining_cogs/session_resumption.rb +92 -0
  47. data/dsl/tutorial/02_chaining_cogs/simple_chain.rb +84 -0
  48. data/dsl/tutorial/03_targets_and_params/README.md +230 -0
  49. data/dsl/tutorial/03_targets_and_params/multiple_targets.rb +65 -0
  50. data/dsl/tutorial/03_targets_and_params/single_target.rb +65 -0
  51. data/dsl/tutorial/04_configuration_options/README.md +209 -0
  52. data/dsl/tutorial/04_configuration_options/control_display_and_temperature.rb +104 -0
  53. data/dsl/tutorial/04_configuration_options/simple_config.rb +68 -0
  54. data/dsl/tutorial/05_control_flow/README.md +156 -0
  55. data/dsl/tutorial/05_control_flow/conditional_execution.rb +62 -0
  56. data/dsl/tutorial/05_control_flow/handling_failures.rb +77 -0
  57. data/dsl/tutorial/06_reusable_scopes/README.md +172 -0
  58. data/dsl/tutorial/06_reusable_scopes/accessing_scope_outputs.rb +126 -0
  59. data/dsl/tutorial/06_reusable_scopes/basic_scope.rb +63 -0
  60. data/dsl/tutorial/06_reusable_scopes/parameterized_scope.rb +78 -0
  61. data/dsl/tutorial/07_processing_collections/README.md +152 -0
  62. data/dsl/tutorial/07_processing_collections/basic_map.rb +70 -0
  63. data/dsl/tutorial/07_processing_collections/parallel_map.rb +74 -0
  64. data/dsl/tutorial/08_iterative_workflows/README.md +231 -0
  65. data/dsl/tutorial/08_iterative_workflows/basic_repeat.rb +57 -0
  66. data/dsl/tutorial/08_iterative_workflows/conditional_break.rb +57 -0
  67. data/dsl/tutorial/09_async_cogs/README.md +197 -0
  68. data/dsl/tutorial/09_async_cogs/basic_async.rb +38 -0
  69. data/dsl/tutorial/README.md +222 -0
  70. data/dsl/working_directory.rb +16 -0
  71. data/exe/roast +1 -1
  72. data/internal/documentation/architectural-notes.md +115 -0
  73. data/internal/documentation/doc-comments-external.md +686 -0
  74. data/internal/documentation/doc-comments-internal.md +342 -0
  75. data/internal/documentation/doc-comments.md +211 -0
  76. data/lib/roast/dsl/cog/config.rb +274 -3
  77. data/lib/roast/dsl/cog/input.rb +53 -10
  78. data/lib/roast/dsl/cog/output.rb +297 -8
  79. data/lib/roast/dsl/cog/registry.rb +35 -3
  80. data/lib/roast/dsl/cog/stack.rb +1 -1
  81. data/lib/roast/dsl/cog/store.rb +5 -5
  82. data/lib/roast/dsl/cog.rb +70 -14
  83. data/lib/roast/dsl/cog_input_context.rb +36 -1
  84. data/lib/roast/dsl/cog_input_manager.rb +116 -7
  85. data/lib/roast/dsl/cogs/agent/config.rb +465 -0
  86. data/lib/roast/dsl/cogs/agent/input.rb +81 -0
  87. data/lib/roast/dsl/cogs/agent/output.rb +59 -0
  88. data/lib/roast/dsl/cogs/agent/provider.rb +51 -0
  89. data/lib/roast/dsl/cogs/agent/providers/claude/claude_invocation.rb +185 -0
  90. data/lib/roast/dsl/cogs/agent/providers/claude/message.rb +73 -0
  91. data/lib/roast/dsl/cogs/agent/providers/claude/messages/assistant_message.rb +36 -0
  92. data/lib/roast/dsl/cogs/agent/providers/claude/messages/result_message.rb +61 -0
  93. data/lib/roast/dsl/cogs/agent/providers/claude/messages/system_message.rb +47 -0
  94. data/lib/roast/dsl/cogs/agent/providers/claude/messages/text_message.rb +36 -0
  95. data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_result_message.rb +47 -0
  96. data/lib/roast/dsl/cogs/agent/providers/claude/messages/tool_use_message.rb +46 -0
  97. data/lib/roast/dsl/cogs/agent/providers/claude/messages/unknown_message.rb +27 -0
  98. data/lib/roast/dsl/cogs/agent/providers/claude/messages/user_message.rb +37 -0
  99. data/lib/roast/dsl/cogs/agent/providers/claude/tool_result.rb +51 -0
  100. data/lib/roast/dsl/cogs/agent/providers/claude/tool_use.rb +48 -0
  101. data/lib/roast/dsl/cogs/agent/providers/claude.rb +31 -0
  102. data/lib/roast/dsl/cogs/agent/stats.rb +92 -0
  103. data/lib/roast/dsl/cogs/agent/usage.rb +62 -0
  104. data/lib/roast/dsl/cogs/agent.rb +75 -0
  105. data/lib/roast/dsl/cogs/chat/config.rb +453 -0
  106. data/lib/roast/dsl/cogs/chat/input.rb +92 -0
  107. data/lib/roast/dsl/cogs/chat/output.rb +64 -0
  108. data/lib/roast/dsl/cogs/chat/session.rb +68 -0
  109. data/lib/roast/dsl/cogs/chat.rb +59 -56
  110. data/lib/roast/dsl/cogs/cmd.rb +248 -61
  111. data/lib/roast/dsl/cogs/ruby.rb +171 -0
  112. data/lib/roast/dsl/command_runner.rb +191 -0
  113. data/lib/roast/dsl/config_manager.rb +58 -11
  114. data/lib/roast/dsl/control_flow.rb +41 -0
  115. data/lib/roast/dsl/execution_manager.rb +162 -32
  116. data/lib/roast/dsl/nil_assertions.rb +23 -0
  117. data/lib/roast/dsl/system_cog/params.rb +32 -0
  118. data/lib/roast/dsl/system_cog.rb +36 -0
  119. data/lib/roast/dsl/system_cogs/call.rb +162 -0
  120. data/lib/roast/dsl/system_cogs/map.rb +448 -0
  121. data/lib/roast/dsl/system_cogs/repeat.rb +242 -0
  122. data/lib/roast/dsl/workflow.rb +26 -16
  123. data/lib/roast/dsl/workflow_context.rb +20 -0
  124. data/lib/roast/dsl/workflow_params.rb +24 -0
  125. data/lib/roast/sorbet_runtime_stub.rb +154 -0
  126. data/lib/roast/tools/apply_diff.rb +1 -3
  127. data/lib/roast/tools/cmd.rb +4 -3
  128. data/lib/roast/tools/read_file.rb +1 -1
  129. data/lib/roast/tools/update_files.rb +1 -1
  130. data/lib/roast/tools/write_file.rb +1 -1
  131. data/lib/roast/version.rb +1 -1
  132. data/lib/roast/workflow/base_workflow.rb +4 -0
  133. data/lib/roast/workflow/step_loader.rb +14 -2
  134. data/lib/roast-ai.rb +4 -0
  135. data/lib/roast.rb +58 -21
  136. data/{roast.gemspec → roast-ai.gemspec} +9 -13
  137. data/sorbet/rbi/gems/async@2.34.0.rbi +1577 -0
  138. data/sorbet/rbi/gems/cli-kit@5.2.0.rbi +2063 -0
  139. data/sorbet/rbi/gems/{cli-ui@2.3.0.rbi → cli-ui@2.7.0-6bdefd1d06305e5d6ae312ac76f9c88f88658dda.rbi} +1418 -1013
  140. data/sorbet/rbi/gems/console@1.34.2.rbi +1193 -0
  141. data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +50 -0
  142. data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +35 -0
  143. data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +41 -0
  144. data/sorbet/rbi/gems/io-event@1.14.0.rbi +724 -0
  145. data/sorbet/rbi/gems/metrics@0.15.0.rbi +9 -0
  146. data/sorbet/rbi/gems/traces@0.18.2.rbi +9 -0
  147. data/sorbet/rbi/shims/lib/roast/dsl/cog_input_context.rbi +1185 -5
  148. data/sorbet/rbi/shims/lib/roast/dsl/config_context.rbi +311 -5
  149. data/sorbet/rbi/shims/lib/roast/dsl/execution_context.rbi +486 -5
  150. data/sorbet/tapioca/config.yml +6 -0
  151. data/sorbet/tapioca/require.rb +2 -0
  152. metadata +157 -30
  153. data/dsl/less_simple.rb +0 -112
  154. data/dsl/scoped_executors.rb +0 -28
  155. data/dsl/simple.rb +0 -8
  156. data/lib/roast/dsl/cogs/execute.rb +0 -46
  157. data/lib/roast/dsl/cogs/graph.rb +0 -53
  158. data/sorbet/rbi/gems/cgi@0.5.0.rbi +0 -2961
  159. data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +0 -568
  160. data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +0 -1991
  161. data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +0 -672
  162. data/sorbet/rbi/gems/dry-core@1.1.0.rbi +0 -1894
  163. data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +0 -659
  164. data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +0 -781
  165. data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +0 -1127
  166. data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +0 -3727
  167. data/sorbet/rbi/gems/dry-types@1.8.3.rbi +0 -3969
  168. data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +0 -1588
  169. data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +0 -136
  170. data/sorbet/rbi/gems/mime-types@3.7.0.rbi +0 -1342
  171. data/sorbet/rbi/gems/rack@2.2.19.rbi +0 -5676
  172. data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +0 -435
  173. data/sorbet/rbi/gems/yard@0.9.37.rbi +0 -18492
@@ -0,0 +1,1193 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `console` gem.
5
+ # Please instead update this file by running `bin/tapioca gem console`.
6
+
7
+
8
+ # source://console//lib/console/version.rb#6
9
+ module Console
10
+ extend ::Console::Interface
11
+ end
12
+
13
+ # A simple clock utility for tracking and formatting time.
14
+ #
15
+ # source://console//lib/console/clock.rb#8
16
+ module Console::Clock
17
+ class << self
18
+ # Format a duration in seconds as a human readable string.
19
+ #
20
+ # source://console//lib/console/clock.rb#13
21
+ def formatted_duration(duration); end
22
+
23
+ # source://console//lib/console/clock.rb#36
24
+ def now; end
25
+ end
26
+ end
27
+
28
+ # Represents a configuration for the traces library.
29
+ #
30
+ # source://console//lib/console/config.rb#14
31
+ class Console::Config
32
+ # Set the default log level based on `$DEBUG` and `$VERBOSE`.
33
+ # You can also specify CONSOLE_LEVEL=debug or CONSOLE_LEVEL=info in environment.
34
+ # https://mislav.net/2011/06/ruby-verbose-mode/ has more details about how it all fits together.
35
+ #
36
+ # source://console//lib/console/config.rb#42
37
+ def log_level(env = T.unsafe(nil)); end
38
+
39
+ # Create a logger with the given output and options.
40
+ #
41
+ # source://console//lib/console/config.rb#75
42
+ def make_logger(io = T.unsafe(nil), env = T.unsafe(nil), **options); end
43
+
44
+ # Create an output with the given output and options.
45
+ #
46
+ # source://console//lib/console/config.rb#57
47
+ def make_output(io = T.unsafe(nil), env = T.unsafe(nil), **options); end
48
+
49
+ # Create a resolver with the given logger.
50
+ #
51
+ # source://console//lib/console/config.rb#65
52
+ def make_resolver(logger); end
53
+
54
+ # Controls verbose output using `$VERBOSE`.
55
+ #
56
+ # @return [Boolean]
57
+ #
58
+ # source://console//lib/console/config.rb#47
59
+ def verbose?(env = T.unsafe(nil)); end
60
+
61
+ class << self
62
+ # Load the default configuration.
63
+ #
64
+ # source://console//lib/console/config.rb#32
65
+ def default; end
66
+
67
+ # Load the configuration from the given path.
68
+ #
69
+ # source://console//lib/console/config.rb#20
70
+ def load(path); end
71
+ end
72
+ end
73
+
74
+ # Load the default configuration.
75
+ #
76
+ # source://console//lib/console/config.rb#94
77
+ Console::Config::DEFAULT = T.let(T.unsafe(nil), Console::Config)
78
+
79
+ # source://console//lib/console/config.rb#15
80
+ Console::Config::PATH = T.let(T.unsafe(nil), String)
81
+
82
+ # Structured event logging.
83
+ #
84
+ # source://console//lib/console/event/generic.rb#7
85
+ module Console::Event; end
86
+
87
+ # Represents a failure of some kind, usually with an attached exception.
88
+ #
89
+ # ```ruby
90
+ # begin
91
+ # raise "Something went wrong!"
92
+ # rescue => exception
93
+ # Console::Event::Failure.log("Something went wrong!", exception)
94
+ # end
95
+ # ```
96
+ #
97
+ # Generally, you should use the {Console.error} method to log failures, as it will automatically create a failure event for you.
98
+ #
99
+ # source://console//lib/console/event/failure.rb#23
100
+ class Console::Event::Failure < ::Console::Event::Generic
101
+ # Create a new failure event for the given exception.
102
+ #
103
+ # @return [Failure] a new instance of Failure
104
+ #
105
+ # source://console//lib/console/event/failure.rb#56
106
+ def initialize(exception, root = T.unsafe(nil)); end
107
+
108
+ # Log the failure event.
109
+ #
110
+ # source://console//lib/console/event/failure.rb#76
111
+ def emit(*arguments, **options); end
112
+
113
+ # Returns the value of attribute exception.
114
+ #
115
+ # source://console//lib/console/event/failure.rb#50
116
+ def exception; end
117
+
118
+ # Convert the failure event to a hash.
119
+ #
120
+ # source://console//lib/console/event/failure.rb#64
121
+ def to_hash; end
122
+
123
+ private
124
+
125
+ # source://console//lib/console/event/failure.rb#84
126
+ def extract(exception, hash); end
127
+
128
+ class << self
129
+ # For the purpose of efficiently formatting backtraces, we need to know the root directory of the project.
130
+ #
131
+ # source://console//lib/console/event/failure.rb#27
132
+ def default_root; end
133
+
134
+ # Create a new failure event for the given exception.
135
+ #
136
+ # source://console//lib/console/event/failure.rb#36
137
+ def for(exception); end
138
+
139
+ # Log a failure event with the given exception.
140
+ #
141
+ # source://console//lib/console/event/failure.rb#45
142
+ def log(subject, exception, **options); end
143
+ end
144
+ end
145
+
146
+ # A generic event which can be used to represent structured data.
147
+ #
148
+ # source://console//lib/console/event/generic.rb#9
149
+ class Console::Event::Generic
150
+ # Convert the event to a hash suitable for JSON serialization.
151
+ #
152
+ # source://console//lib/console/event/generic.rb#20
153
+ def as_json(*_arg0, **_arg1, &_arg2); end
154
+
155
+ # Log the event using the given output interface.
156
+ #
157
+ # source://console//lib/console/event/generic.rb#42
158
+ def emit(*arguments, **options); end
159
+
160
+ # Convert the event to a hash suitable for JSON serialization.
161
+ #
162
+ # source://console//lib/console/event/generic.rb#13
163
+ def to_hash; end
164
+
165
+ # Serialize the event to JSON.
166
+ #
167
+ # source://console//lib/console/event/generic.rb#27
168
+ def to_json(*_arg0, **_arg1, &_arg2); end
169
+
170
+ # Convert the event to a string (JSON).
171
+ #
172
+ # source://console//lib/console/event/generic.rb#34
173
+ def to_s; end
174
+ end
175
+
176
+ # Represents a child process spawn event.
177
+ #
178
+ # ```ruby
179
+ # Console.info(self, **Console::Event::Spawn.for("ls", "-l"))
180
+ #
181
+ # event = Console::Event::Spawn.for("ls", "-l")
182
+ # event.status = Process.wait
183
+ # ```
184
+ #
185
+ # source://console//lib/console/event/spawn.rb#19
186
+ class Console::Event::Spawn < ::Console::Event::Generic
187
+ # Create a new spawn event.
188
+ #
189
+ # @return [Spawn] a new instance of Spawn
190
+ #
191
+ # source://console//lib/console/event/spawn.rb#40
192
+ def initialize(environment, arguments, options); end
193
+
194
+ # Calculate the duration of the command, if it has completed.
195
+ #
196
+ # source://console//lib/console/event/spawn.rb#71
197
+ def duration; end
198
+
199
+ # Log the spawn event.
200
+ #
201
+ # source://console//lib/console/event/spawn.rb#99
202
+ def emit(*arguments, **options); end
203
+
204
+ # Returns the value of attribute end_time.
205
+ #
206
+ # source://console//lib/console/event/spawn.rb#55
207
+ def end_time; end
208
+
209
+ # Returns the value of attribute start_time.
210
+ #
211
+ # source://console//lib/console/event/spawn.rb#52
212
+ def start_time; end
213
+
214
+ # Returns the value of attribute status.
215
+ #
216
+ # source://console//lib/console/event/spawn.rb#58
217
+ def status; end
218
+
219
+ # Set the status of the command, and record the end time.
220
+ #
221
+ # source://console//lib/console/event/spawn.rb#63
222
+ def status=(status); end
223
+
224
+ # Convert the spawn event to a hash suitable for JSON serialization.
225
+ #
226
+ # source://console//lib/console/event/spawn.rb#80
227
+ def to_hash; end
228
+
229
+ class << self
230
+ # Create a new spawn event.
231
+ #
232
+ # source://console//lib/console/event/spawn.rb#25
233
+ def for(*arguments, **options); end
234
+ end
235
+ end
236
+
237
+ # A log filter which can be used to filter log messages based on severity, subject, and other criteria.
238
+ #
239
+ # source://console//lib/console/filter.rb#13
240
+ class Console::Filter
241
+ # Create a new log filter.
242
+ #
243
+ # @return [Filter] a new instance of Filter
244
+ #
245
+ # source://console//lib/console/filter.rb#73
246
+ def initialize(output, verbose: T.unsafe(nil), level: T.unsafe(nil), **options); end
247
+
248
+ # Enable all logging.
249
+ #
250
+ # source://console//lib/console/filter.rb#143
251
+ def all!; end
252
+
253
+ # Log a message with the given severity.
254
+ #
255
+ # source://console//lib/console/filter.rb#214
256
+ def call(subject, *arguments, **options, &block); end
257
+
258
+ # Clear any specific filters for the given class.
259
+ #
260
+ # source://console//lib/console/filter.rb#199
261
+ def clear(subject); end
262
+
263
+ # Disable logging for the given class.
264
+ #
265
+ # source://console//lib/console/filter.rb#191
266
+ def disable(subject); end
267
+
268
+ # Enable specific log level for the given class.
269
+ #
270
+ # source://console//lib/console/filter.rb#183
271
+ def enable(subject, level = T.unsafe(nil)); end
272
+
273
+ # Whether logging is enabled for the given subject and log level.
274
+ #
275
+ # You can enable and disable logging for classes. This function checks if logging for a given subject is enabled.
276
+ #
277
+ # @return [Boolean]
278
+ #
279
+ # source://console//lib/console/filter.rb#168
280
+ def enabled?(subject, level = T.unsafe(nil)); end
281
+
282
+ # Filter log messages based on the subject and log level.
283
+ #
284
+ # You must provide the subject's class, not an instance of the class.
285
+ #
286
+ # source://console//lib/console/filter.rb#153
287
+ def filter(subject, level); end
288
+
289
+ # Returns the value of attribute level.
290
+ #
291
+ # source://console//lib/console/filter.rb#110
292
+ def level; end
293
+
294
+ # Set the log level.
295
+ #
296
+ # source://console//lib/console/filter.rb#121
297
+ def level=(level); end
298
+
299
+ # Disable all logging.
300
+ #
301
+ # source://console//lib/console/filter.rb#138
302
+ def off!; end
303
+
304
+ # Returns the value of attribute options.
305
+ #
306
+ # source://console//lib/console/filter.rb#116
307
+ def options; end
308
+
309
+ # Sets the attribute options
310
+ #
311
+ # @param value the value to set the attribute options to.
312
+ #
313
+ # source://console//lib/console/filter.rb#116
314
+ def options=(_arg0); end
315
+
316
+ # Returns the value of attribute output.
317
+ #
318
+ # source://console//lib/console/filter.rb#104
319
+ def output; end
320
+
321
+ # Sets the attribute output
322
+ #
323
+ # @param value the value to set the attribute output to.
324
+ #
325
+ # source://console//lib/console/filter.rb#104
326
+ def output=(_arg0); end
327
+
328
+ # Returns the value of attribute subjects.
329
+ #
330
+ # source://console//lib/console/filter.rb#113
331
+ def subjects; end
332
+
333
+ # Returns the value of attribute verbose.
334
+ #
335
+ # source://console//lib/console/filter.rb#107
336
+ def verbose; end
337
+
338
+ # Set verbose output (enable by default with no arguments).
339
+ #
340
+ # source://console//lib/console/filter.rb#132
341
+ def verbose!(value = T.unsafe(nil)); end
342
+
343
+ # Create a new log filter with the given options, from an existing log filter.
344
+ #
345
+ # source://console//lib/console/filter.rb#95
346
+ def with(level: T.unsafe(nil), verbose: T.unsafe(nil), **options); end
347
+
348
+ class << self
349
+ # Create a new log filter with specific log levels.
350
+ #
351
+ # ```ruby
352
+ # class MyLogger < Console::Filter[debug: 0, okay: 1, bad: 2, terrible: 3]
353
+ # ```
354
+ #
355
+ # source://console//lib/console/filter.rb#34
356
+ def [](**levels); end
357
+
358
+ # Define a method.
359
+ #
360
+ # source://console//lib/console/filter.rb#16
361
+ def define_immutable_method(name, &block); end
362
+ end
363
+ end
364
+
365
+ # source://console//lib/console/format/safe.rb#10
366
+ module Console::Format
367
+ class << self
368
+ # A safe format for converting objects to strings.
369
+ #
370
+ # source://console//lib/console/format.rb#13
371
+ def default; end
372
+ end
373
+ end
374
+
375
+ # A safe format for converting objects to strings.
376
+ #
377
+ # Handles issues like circular references and encoding errors.
378
+ #
379
+ # source://console//lib/console/format/safe.rb#14
380
+ class Console::Format::Safe
381
+ # Create a new safe format.
382
+ #
383
+ # @return [Safe] a new instance of Safe
384
+ #
385
+ # source://console//lib/console/format/safe.rb#20
386
+ def initialize(format: T.unsafe(nil), limit: T.unsafe(nil), encoding: T.unsafe(nil)); end
387
+
388
+ # Dump the given object to a string.
389
+ #
390
+ # source://console//lib/console/format/safe.rb#30
391
+ def dump(object); end
392
+
393
+ private
394
+
395
+ # Create a new hash with identity comparison.
396
+ #
397
+ # source://console//lib/console/format/safe.rb#100
398
+ def default_objects; end
399
+
400
+ # Filter the backtrace to remove duplicate frames and reduce verbosity.
401
+ #
402
+ # source://console//lib/console/format/safe.rb#42
403
+ def filter_backtrace(error); end
404
+
405
+ # Dump the given object to a string, replacing it with a safe representation if there is an error.
406
+ #
407
+ # This is a slow path so we try to avoid it.
408
+ #
409
+ # source://console//lib/console/format/safe.rb#86
410
+ def safe_dump(object, error); end
411
+
412
+ # This will recursively generate a safe version of the object. Nested hashes and arrays will be transformed recursively. Strings will be encoded with the given encoding. Primitive values will be returned as-is. Other values will be converted using `as_json` if available, otherwise `to_s`.
413
+ #
414
+ # source://console//lib/console/format/safe.rb#110
415
+ def safe_dump_recurse(object, limit = T.unsafe(nil), objects = T.unsafe(nil)); end
416
+ end
417
+
418
+ # The public logger interface.
419
+ #
420
+ # source://console//lib/console/interface.rb#11
421
+ module Console::Interface
422
+ extend ::Fiber::Local
423
+
424
+ # Emit a log message with arbitrary arguments and options.
425
+ #
426
+ # source://console//lib/console/interface.rb#57
427
+ def call(*_arg0, **_arg1, &_arg2); end
428
+
429
+ # Emit a debug log message.
430
+ #
431
+ # source://console//lib/console/interface.rb#32
432
+ def debug(*_arg0, **_arg1, &_arg2); end
433
+
434
+ # Emit an error log message.
435
+ #
436
+ # source://console//lib/console/interface.rb#47
437
+ def error(*_arg0, **_arg1, &_arg2); end
438
+
439
+ # Emit a fatal log message.
440
+ #
441
+ # source://console//lib/console/interface.rb#52
442
+ def fatal(*_arg0, **_arg1, &_arg2); end
443
+
444
+ # Emit an informational log message.
445
+ #
446
+ # source://console//lib/console/interface.rb#37
447
+ def info(*_arg0, **_arg1, &_arg2); end
448
+
449
+ # Get the current logger instance.
450
+ #
451
+ # source://console//lib/console/interface.rb#20
452
+ def logger; end
453
+
454
+ # Set the current logger instance.
455
+ #
456
+ # The current logger instance is assigned per-fiber.
457
+ #
458
+ # source://console//lib/console/interface.rb#27
459
+ def logger=(instance); end
460
+
461
+ # Emit a warning log message.
462
+ #
463
+ # source://console//lib/console/interface.rb#42
464
+ def warn(*_arg0, **_arg1, &_arg2); end
465
+
466
+ class << self
467
+ # source://fiber-local/1.1.0/lib/fiber/local.rb#16
468
+ def fiber_local_attribute_name; end
469
+
470
+ # Create a new (thread local) logger instance.
471
+ #
472
+ # source://console//lib/console/interface.rb#15
473
+ def local; end
474
+ end
475
+ end
476
+
477
+ # The standard logger interface with support for log levels and verbosity.
478
+ #
479
+ # The log levels are: `debug`, `info`, `warn`, `error`, and `fatal`.
480
+ #
481
+ # source://console//lib/console/logger.rb#20
482
+ class Console::Logger < ::Console::Filter
483
+ # Create a new logger.
484
+ #
485
+ # @return [Logger] a new instance of Logger
486
+ #
487
+ # source://console//lib/console/logger.rb#47
488
+ def initialize(output, **options); end
489
+
490
+ # Create a progress indicator for the given subject.
491
+ #
492
+ # source://console//lib/console/logger.rb#60
493
+ def progress(subject, total, **options); end
494
+
495
+ class << self
496
+ # Set the default log level based on `$DEBUG` and `$VERBOSE`.
497
+ # You can also specify CONSOLE_LEVEL=debug or CONSOLE_LEVEL=info in environment.
498
+ # https://mislav.net/2011/06/ruby-verbose-mode/ has more details about how it all fits together.
499
+ #
500
+ # source://console//lib/console/logger.rb#29
501
+ def default_log_level(env = T.unsafe(nil), verbose: T.unsafe(nil), debug: T.unsafe(nil)); end
502
+ end
503
+ end
504
+
505
+ # source://console//lib/console/logger.rb#41
506
+ Console::Logger::DEFAULT_LEVEL = T.let(T.unsafe(nil), Integer)
507
+
508
+ # Output handling.
509
+ #
510
+ # source://console//lib/console/output/terminal.rb#16
511
+ module Console::Output
512
+ class << self
513
+ # Create a new output based on the environment.
514
+ #
515
+ # The environment variable `CONSOLE_OUTPUT` can be used to specify a list of output classes to wrap around the output. If not specified the {Default} output is used.
516
+ #
517
+ # The output argument is deliberately unders-specified but can be an IO object or an instance of {Output}.
518
+ #
519
+ # source://console//lib/console/output.rb#24
520
+ def new(output = T.unsafe(nil), env = T.unsafe(nil), **options); end
521
+ end
522
+ end
523
+
524
+ # Default output format selection.
525
+ #
526
+ # source://console//lib/console/output/default.rb#13
527
+ module Console::Output::Default
528
+ class << self
529
+ # Detect if we're running in GitHub Actions, where human-readable output is preferred.
530
+ # GitHub Actions sets the GITHUB_ACTIONS environment variable to "true".
531
+ #
532
+ # @return [Boolean]
533
+ #
534
+ # source://console//lib/console/output/default.rb#46
535
+ def github_actions?(env = T.unsafe(nil)); end
536
+
537
+ # Detect if we're running in a cron job or mail context where human-readable output is preferred.
538
+ # Cron jobs often have MAILTO set and lack TERM, or have minimal TERM values.
539
+ #
540
+ # @return [Boolean]
541
+ #
542
+ # source://console//lib/console/output/default.rb#40
543
+ def mail?(env = T.unsafe(nil)); end
544
+
545
+ # Create a new output format based on the given stream.
546
+ #
547
+ # source://console//lib/console/output/default.rb#20
548
+ def new(stream, env: T.unsafe(nil), **options); end
549
+ end
550
+ end
551
+
552
+ # A wrapper for outputting failure messages, which can include exceptions.
553
+ #
554
+ # source://console//lib/console/output/failure.rb#12
555
+ class Console::Output::Failure < ::Console::Output::Wrapper
556
+ # Create a new failure output wrapper.
557
+ #
558
+ # @return [Failure] a new instance of Failure
559
+ #
560
+ # source://console//lib/console/output/failure.rb#14
561
+ def initialize(output, **options); end
562
+
563
+ # The exception must be either the last argument or passed as an option.
564
+ #
565
+ # source://console//lib/console/output/failure.rb#25
566
+ def call(subject = T.unsafe(nil), *arguments, exception: T.unsafe(nil), **options, &block); end
567
+ end
568
+
569
+ # @deprecated This is a legacy constant, please use `Serialized` instead.
570
+ #
571
+ # source://console//lib/console/output/serialized.rb#100
572
+ Console::Output::JSON = Console::Output::Serialized
573
+
574
+ # A null output that does nothing.
575
+ #
576
+ # source://console//lib/console/output/null.rb#9
577
+ class Console::Output::Null
578
+ # Create a new null output.
579
+ #
580
+ # @return [Null] a new instance of Null
581
+ #
582
+ # source://console//lib/console/output/null.rb#11
583
+ def initialize(*_arg0, **_arg1, &_arg2); end
584
+
585
+ # Do nothing.
586
+ #
587
+ # source://console//lib/console/output/null.rb#20
588
+ def call(*_arg0, **_arg1, &_arg2); end
589
+
590
+ # The last output is always self.
591
+ #
592
+ # source://console//lib/console/output/null.rb#15
593
+ def last_output; end
594
+ end
595
+
596
+ # Serialize log messages in a structured format.
597
+ #
598
+ # source://console//lib/console/output/serialized.rb#13
599
+ class Console::Output::Serialized
600
+ # Create a new serialized output.
601
+ #
602
+ # @return [Serialized] a new instance of Serialized
603
+ #
604
+ # source://console//lib/console/output/serialized.rb#19
605
+ def initialize(stream, format: T.unsafe(nil), **options); end
606
+
607
+ # Output the given log message.
608
+ #
609
+ # source://console//lib/console/output/serialized.rb#50
610
+ def call(subject = T.unsafe(nil), *arguments, severity: T.unsafe(nil), **options, &block); end
611
+
612
+ # Serialize the given record.
613
+ #
614
+ # source://console//lib/console/output/serialized.rb#39
615
+ def dump(record); end
616
+
617
+ # Returns the value of attribute format.
618
+ #
619
+ # source://console//lib/console/output/serialized.rb#33
620
+ def format; end
621
+
622
+ # This a final output that then writes to an IO object.
623
+ #
624
+ # source://console//lib/console/output/serialized.rb#25
625
+ def last_output; end
626
+
627
+ # Returns the value of attribute stream.
628
+ #
629
+ # source://console//lib/console/output/serialized.rb#30
630
+ def stream; end
631
+ end
632
+
633
+ # Represents a terminal output, and formats log messages for display.
634
+ #
635
+ # source://console//lib/console/output/terminal.rb#18
636
+ class Console::Output::Terminal
637
+ # Create a new terminal output.
638
+ #
639
+ # @return [Terminal] a new instance of Terminal
640
+ #
641
+ # source://console//lib/console/output/terminal.rb#72
642
+ def initialize(stream, verbose: T.unsafe(nil), start_at: T.unsafe(nil), format: T.unsafe(nil), **options); end
643
+
644
+ # Log a message with the given severity.
645
+ #
646
+ # source://console//lib/console/output/terminal.rb#145
647
+ def call(subject = T.unsafe(nil), *arguments, name: T.unsafe(nil), severity: T.unsafe(nil), event: T.unsafe(nil), **options, &block); end
648
+
649
+ # This a final output.
650
+ #
651
+ # source://console//lib/console/output/terminal.rb#100
652
+ def last_output; end
653
+
654
+ # Register all formatters in the given namespace.
655
+ #
656
+ # source://console//lib/console/output/terminal.rb#124
657
+ def register_formatters(namespace = T.unsafe(nil)); end
658
+
659
+ # Returns the value of attribute start.
660
+ #
661
+ # source://console//lib/console/output/terminal.rb#111
662
+ def start; end
663
+
664
+ # Returns the value of attribute stream.
665
+ #
666
+ # source://console//lib/console/output/terminal.rb#105
667
+ def stream; end
668
+
669
+ # Returns the value of attribute terminal.
670
+ #
671
+ # source://console//lib/console/output/terminal.rb#114
672
+ def terminal; end
673
+
674
+ # Returns the value of attribute verbose.
675
+ #
676
+ # source://console//lib/console/output/terminal.rb#108
677
+ def verbose; end
678
+
679
+ # Set the verbose output.
680
+ #
681
+ # source://console//lib/console/output/terminal.rb#119
682
+ def verbose!(value = T.unsafe(nil)); end
683
+
684
+ # Sets the attribute verbose
685
+ #
686
+ # @param value the value to set the attribute verbose to.
687
+ #
688
+ # source://console//lib/console/output/terminal.rb#108
689
+ def verbose=(_arg0); end
690
+
691
+ protected
692
+
693
+ # source://console//lib/console/output/terminal.rb#275
694
+ def build_prefix(name); end
695
+
696
+ # source://console//lib/console/output/terminal.rb#212
697
+ def default_suffix(object = T.unsafe(nil)); end
698
+
699
+ # source://console//lib/console/output/terminal.rb#196
700
+ def format_argument(argument, output); end
701
+
702
+ # source://console//lib/console/output/terminal.rb#181
703
+ def format_event(event, buffer, width); end
704
+
705
+ # source://console//lib/console/output/terminal.rb#238
706
+ def format_object_subject(severity, prefix, subject, output); end
707
+
708
+ # source://console//lib/console/output/terminal.rb#192
709
+ def format_options(options, output); end
710
+
711
+ # source://console//lib/console/output/terminal.rb#250
712
+ def format_string_subject(severity, prefix, subject, output); end
713
+
714
+ # source://console//lib/console/output/terminal.rb#202
715
+ def format_subject(severity, prefix, subject, buffer); end
716
+
717
+ # source://console//lib/console/output/terminal.rb#262
718
+ def format_value(value, output); end
719
+
720
+ # source://console//lib/console/output/terminal.rb#271
721
+ def time_offset_prefix; end
722
+
723
+ class << self
724
+ # Exports CONSOLE_START_AT which can be used to synchronize the start times of all child processes when they log using delta time.
725
+ #
726
+ # source://console//lib/console/output/terminal.rb#52
727
+ def start_at!(env = T.unsafe(nil)); end
728
+ end
729
+ end
730
+
731
+ # Represents an output buffer that formats lines with a prefix.
732
+ #
733
+ # source://console//lib/console/output/terminal.rb#20
734
+ class Console::Output::Terminal::Buffer < ::StringIO
735
+ # Create a new buffer with the given prefix.
736
+ #
737
+ # @return [Buffer] a new instance of Buffer
738
+ #
739
+ # source://console//lib/console/output/terminal.rb#24
740
+ def initialize(prefix = T.unsafe(nil)); end
741
+
742
+ # Write lines using the given prefix.
743
+ # Write a line to the buffer.
744
+ #
745
+ # source://console//lib/console/output/terminal.rb#37
746
+ def <<(*lines, prefix: T.unsafe(nil)); end
747
+
748
+ # Returns the value of attribute prefix.
749
+ #
750
+ # source://console//lib/console/output/terminal.rb#31
751
+ def prefix; end
752
+
753
+ # Write lines using the given prefix.
754
+ #
755
+ # source://console//lib/console/output/terminal.rb#37
756
+ def puts(*lines, prefix: T.unsafe(nil)); end
757
+ end
758
+
759
+ # The environment variable used to store the start time of the console terminal output.
760
+ #
761
+ # source://console//lib/console/output/terminal.rb#49
762
+ Console::Output::Terminal::CONSOLE_START_AT = T.let(T.unsafe(nil), String)
763
+
764
+ # The default severity for log messages, if not specified.
765
+ #
766
+ # source://console//lib/console/output/terminal.rb#132
767
+ Console::Output::Terminal::UNKNOWN = T.let(T.unsafe(nil), Symbol)
768
+
769
+ # Terminal text output.
770
+ #
771
+ # source://console//lib/console/output/terminal.rb#285
772
+ module Console::Output::Text
773
+ class << self
774
+ # Create a new terminal output.
775
+ #
776
+ # source://console//lib/console/output/terminal.rb#291
777
+ def new(output, **options); end
778
+ end
779
+ end
780
+
781
+ # A generic wrapper for output handling.
782
+ #
783
+ # source://console//lib/console/output/wrapper.rb#9
784
+ class Console::Output::Wrapper
785
+ # Create a new wrapper output.
786
+ #
787
+ # @return [Wrapper] a new instance of Wrapper
788
+ #
789
+ # source://console//lib/console/output/wrapper.rb#14
790
+ def initialize(delegate, **options); end
791
+
792
+ # Invoke the delegate.
793
+ #
794
+ # source://console//lib/console/output/wrapper.rb#34
795
+ def call(*_arg0, **_arg1, &_arg2); end
796
+
797
+ # Returns the value of attribute delegate.
798
+ #
799
+ # source://console//lib/console/output/wrapper.rb#19
800
+ def delegate; end
801
+
802
+ # The last output is the last output of the delegate.
803
+ #
804
+ # source://console//lib/console/output/wrapper.rb#22
805
+ def last_output; end
806
+
807
+ # Set the verbose flag for the delegate.
808
+ #
809
+ # source://console//lib/console/output/wrapper.rb#29
810
+ def verbose!(value = T.unsafe(nil)); end
811
+ end
812
+
813
+ # Terminal XTerm output.
814
+ #
815
+ # source://console//lib/console/output/terminal.rb#297
816
+ module Console::Output::XTerm
817
+ class << self
818
+ # Create a new terminal output.
819
+ #
820
+ # You can use this to force XTerm output on a non-TTY output streams that support XTerm escape codes.
821
+ #
822
+ # source://console//lib/console/output/terminal.rb#305
823
+ def new(output, **options); end
824
+ end
825
+ end
826
+
827
+ # A simple progress indicator
828
+ #
829
+ # source://console//lib/console/progress.rb#11
830
+ class Console::Progress
831
+ # Create a new progress indicator.
832
+ #
833
+ # @return [Progress] a new instance of Progress
834
+ #
835
+ # source://console//lib/console/progress.rb#23
836
+ def initialize(subject, total = T.unsafe(nil), minimum_output_duration: T.unsafe(nil), **options); end
837
+
838
+ # source://console//lib/console/progress.rb#67
839
+ def average_duration; end
840
+
841
+ # Returns the value of attribute current.
842
+ #
843
+ # source://console//lib/console/progress.rb#46
844
+ def current; end
845
+
846
+ # source://console//lib/console/progress.rb#52
847
+ def duration; end
848
+
849
+ # source://console//lib/console/progress.rb#74
850
+ def estimated_remaining_time; end
851
+
852
+ # Increment the progress indicator by the given amount.
853
+ #
854
+ # source://console//lib/console/progress.rb#98
855
+ def increment(amount = T.unsafe(nil)); end
856
+
857
+ # Augment the progress indicator with additional information.
858
+ #
859
+ # source://console//lib/console/progress.rb#127
860
+ def mark(*arguments, **options, &block); end
861
+
862
+ # Returns the value of attribute minimum_output_duration.
863
+ #
864
+ # source://console//lib/console/progress.rb#40
865
+ def minimum_output_duration; end
866
+
867
+ # source://console//lib/console/progress.rb#57
868
+ def ratio; end
869
+
870
+ # source://console//lib/console/progress.rb#62
871
+ def remaining; end
872
+
873
+ # Resize the progress indicator to the given total.
874
+ #
875
+ # source://console//lib/console/progress.rb#113
876
+ def resize(total); end
877
+
878
+ # Returns the value of attribute start_time.
879
+ #
880
+ # source://console//lib/console/progress.rb#43
881
+ def start_time; end
882
+
883
+ # Returns the value of attribute subject.
884
+ #
885
+ # source://console//lib/console/progress.rb#37
886
+ def subject; end
887
+
888
+ # Generate an appropriate event for the progress indicator.
889
+ #
890
+ # source://console//lib/console/progress.rb#83
891
+ def to_hash; end
892
+
893
+ # source://console//lib/console/progress.rb#132
894
+ def to_s; end
895
+
896
+ # Returns the value of attribute total.
897
+ #
898
+ # source://console//lib/console/progress.rb#49
899
+ def total; end
900
+
901
+ private
902
+
903
+ # Compute a time delta since the last output, used for rate limiting the output.
904
+ #
905
+ # source://console//lib/console/progress.rb#145
906
+ def duration_since_last_output; end
907
+
908
+ # Whether an output should be generated at this time, taking into account the remaining steps, and the duration since the last output.
909
+ #
910
+ # @return [Boolean]
911
+ #
912
+ # source://console//lib/console/progress.rb#154
913
+ def output?; end
914
+
915
+ class << self
916
+ # @deprecated Use {Clock.now} instead.
917
+ #
918
+ # source://console//lib/console/progress.rb#13
919
+ def now; end
920
+ end
921
+ end
922
+
923
+ # Represents a class resolver that can be used to set log levels for different classes as they become available.
924
+ #
925
+ # source://console//lib/console/resolver.rb#11
926
+ class Console::Resolver
927
+ # Create a new class resolver.
928
+ #
929
+ # @return [Resolver] a new instance of Resolver
930
+ #
931
+ # source://console//lib/console/resolver.rb#63
932
+ def initialize; end
933
+
934
+ # Bind the given class names to the given block. When the class name is resolved into an actual class, the block will be called with the class as an argument.
935
+ #
936
+ # If the class is already defined, the block will be called immediately.
937
+ #
938
+ # If the class is not defined, the block will be called when the class is defined, using a trace point.
939
+ #
940
+ # source://console//lib/console/resolver.rb#77
941
+ def bind(names, &block); end
942
+
943
+ # Invoked by the trace point when a class is defined.
944
+ #
945
+ # This will call the block associated with the class name, if any, and remove it from the list of names to resolve.
946
+ #
947
+ # If the list of names is empty, the trace point will be disabled.
948
+ #
949
+ # source://console//lib/console/resolver.rb#105
950
+ def resolve(trace_point); end
951
+
952
+ # @return [Boolean]
953
+ #
954
+ # source://console//lib/console/resolver.rb#94
955
+ def waiting?; end
956
+
957
+ class << self
958
+ # You can change the log level for different classes using CONSOLE_$LEVEL env vars.
959
+ #
960
+ # e.g. `CONSOLE_WARN=Acorn,Banana CONSOLE_DEBUG=Cat` will set the log level for the classes Acorn and Banana to `warn` and Cat to `debug`. This overrides the default log level.
961
+ #
962
+ # You can enable all log levels for a given class by using `CONSOLE_ON=MyClass`. Similarly you can disable all logging using `CONSOLE_OFF=MyClass`.
963
+ #
964
+ # source://console//lib/console/resolver.rb#22
965
+ def default_resolver(logger, env = T.unsafe(nil)); end
966
+ end
967
+ end
968
+
969
+ # Styled terminal output.
970
+ #
971
+ # source://console//lib/console/terminal/text.rb#11
972
+ module Console::Terminal
973
+ class << self
974
+ # Create a new terminal output for the given stream.
975
+ #
976
+ # source://console//lib/console/terminal.rb#13
977
+ def for(stream); end
978
+ end
979
+ end
980
+
981
+ # Formatters for various types of events.
982
+ #
983
+ # source://console//lib/console/terminal/formatter/progress.rb#8
984
+ module Console::Terminal::Formatter; end
985
+
986
+ # Format a failure event, including the exception message and backtrace.
987
+ #
988
+ # source://console//lib/console/terminal/formatter/failure.rb#10
989
+ class Console::Terminal::Formatter::Failure
990
+ # Create a new failure formatter.
991
+ #
992
+ # @param terminal [Terminal::Text] The terminal to use for formatting.
993
+ # @return [Failure] a new instance of Failure
994
+ #
995
+ # source://console//lib/console/terminal/formatter/failure.rb#17
996
+ def initialize(terminal); end
997
+
998
+ # Format the given event.
999
+ #
1000
+ # source://console//lib/console/terminal/formatter/failure.rb#34
1001
+ def format(event, stream, prefix: T.unsafe(nil), verbose: T.unsafe(nil), **options); end
1002
+ end
1003
+
1004
+ # The key used to identify this formatter.
1005
+ #
1006
+ # source://console//lib/console/terminal/formatter/failure.rb#12
1007
+ Console::Terminal::Formatter::Failure::KEY = T.let(T.unsafe(nil), Symbol)
1008
+
1009
+ # Format a progress event, including the current progress and total.
1010
+ #
1011
+ # source://console//lib/console/terminal/formatter/progress.rb#10
1012
+ class Console::Terminal::Formatter::Progress
1013
+ # Create a new progress formatter.
1014
+ #
1015
+ # @param terminal [Terminal::Text] The terminal to use for formatting.
1016
+ # @return [Progress] a new instance of Progress
1017
+ #
1018
+ # source://console//lib/console/terminal/formatter/progress.rb#30
1019
+ def initialize(terminal); end
1020
+
1021
+ # Format the given event.
1022
+ #
1023
+ # source://console//lib/console/terminal/formatter/progress.rb#41
1024
+ def format(event, stream, verbose: T.unsafe(nil), width: T.unsafe(nil)); end
1025
+
1026
+ private
1027
+
1028
+ # Render a progress bar with the given value and width.
1029
+ #
1030
+ # source://console//lib/console/terminal/formatter/progress.rb#57
1031
+ def bar(value, width); end
1032
+ end
1033
+
1034
+ # The block characters used to render the progress bar.
1035
+ #
1036
+ # source://console//lib/console/terminal/formatter/progress.rb#15
1037
+ Console::Terminal::Formatter::Progress::BLOCK = T.let(T.unsafe(nil), Array)
1038
+
1039
+ # The key used to identify this formatter.
1040
+ #
1041
+ # source://console//lib/console/terminal/formatter/progress.rb#12
1042
+ Console::Terminal::Formatter::Progress::KEY = T.let(T.unsafe(nil), Symbol)
1043
+
1044
+ # Format a spawn event, including the command and arguments.
1045
+ #
1046
+ # source://console//lib/console/terminal/formatter/spawn.rb#10
1047
+ class Console::Terminal::Formatter::Spawn
1048
+ # Create a new spawn formatter.
1049
+ #
1050
+ # @param terminal [Terminal::Text] The terminal to use for formatting.
1051
+ # @return [Spawn] a new instance of Spawn
1052
+ #
1053
+ # source://console//lib/console/terminal/formatter/spawn.rb#17
1054
+ def initialize(terminal); end
1055
+
1056
+ # Format the given event.
1057
+ #
1058
+ # source://console//lib/console/terminal/formatter/spawn.rb#28
1059
+ def format(event, stream, verbose: T.unsafe(nil), width: T.unsafe(nil)); end
1060
+
1061
+ private
1062
+
1063
+ # Generate a string to represent the working directory.
1064
+ #
1065
+ # source://console//lib/console/terminal/formatter/spawn.rb#45
1066
+ def chdir_string(options); end
1067
+ end
1068
+
1069
+ # The key used to identify this formatter.
1070
+ #
1071
+ # source://console//lib/console/terminal/formatter/spawn.rb#12
1072
+ Console::Terminal::Formatter::Spawn::KEY = T.let(T.unsafe(nil), Symbol)
1073
+
1074
+ # A simple text-based terminal output.
1075
+ #
1076
+ # source://console//lib/console/terminal/text.rb#13
1077
+ class Console::Terminal::Text
1078
+ # Create a new text terminal output.
1079
+ #
1080
+ # @return [Text] a new instance of Text
1081
+ #
1082
+ # source://console//lib/console/terminal/text.rb#17
1083
+ def initialize(stream); end
1084
+
1085
+ # Get the style associated with the given key.
1086
+ #
1087
+ # source://console//lib/console/terminal/text.rb#29
1088
+ def [](key); end
1089
+
1090
+ # Set the style associated with the given key.
1091
+ #
1092
+ # source://console//lib/console/terminal/text.rb#37
1093
+ def []=(key, value); end
1094
+
1095
+ # @return [Boolean]
1096
+ #
1097
+ # source://console//lib/console/terminal/text.rb#42
1098
+ def colors?; end
1099
+
1100
+ # Print rich text to the output stream.
1101
+ #
1102
+ # - When the argument is a symbol, look up the style and inject it into the output stream.
1103
+ # - When the argument is a proc/lambda, call it with self as the argument.
1104
+ # - When the argument is anything else, write it directly to the output.
1105
+ #
1106
+ # source://console//lib/console/terminal/text.rb#107
1107
+ def print(*arguments); end
1108
+
1109
+ # Print rich text to the output stream, followed by the reset sequence and a newline.
1110
+ #
1111
+ # source://console//lib/console/terminal/text.rb#123
1112
+ def print_line(*arguments); end
1113
+
1114
+ # Write the given arguments to the output stream using the given style. The reset sequence is automatically
1115
+ # appended at the end of each line.
1116
+ #
1117
+ # source://console//lib/console/terminal/text.rb#87
1118
+ def puts(*arguments, style: T.unsafe(nil)); end
1119
+
1120
+ # Generate a reset sequence.
1121
+ #
1122
+ # source://console//lib/console/terminal/text.rb#65
1123
+ def reset; end
1124
+
1125
+ # source://console//lib/console/terminal/text.rb#47
1126
+ def size; end
1127
+
1128
+ # Returns the value of attribute stream.
1129
+ #
1130
+ # source://console//lib/console/terminal/text.rb#23
1131
+ def stream; end
1132
+
1133
+ # Generate a style string for the given foreground, background, and attributes.
1134
+ #
1135
+ # source://console//lib/console/terminal/text.rb#59
1136
+ def style(foreground, background = T.unsafe(nil), *attributes); end
1137
+
1138
+ # source://console//lib/console/terminal/text.rb#52
1139
+ def width; end
1140
+
1141
+ # Write the given arguments to the output stream using the given style. The reset sequence is automatically appended.
1142
+ #
1143
+ # source://console//lib/console/terminal/text.rb#72
1144
+ def write(*arguments, style: T.unsafe(nil)); end
1145
+ end
1146
+
1147
+ # XTerm style terminal output.
1148
+ #
1149
+ # source://console//lib/console/terminal/xterm.rb#14
1150
+ class Console::Terminal::XTerm < ::Console::Terminal::Text
1151
+ # Whether the terminal supports colors.
1152
+ #
1153
+ # @return [Boolean]
1154
+ #
1155
+ # source://console//lib/console/terminal/xterm.rb#42
1156
+ def colors?; end
1157
+
1158
+ # Reset the style.
1159
+ #
1160
+ # source://console//lib/console/terminal/xterm.rb#86
1161
+ def reset; end
1162
+
1163
+ # The size of the terminal.
1164
+ #
1165
+ # source://console//lib/console/terminal/xterm.rb#47
1166
+ def size; end
1167
+
1168
+ # Apply the given style to the output.
1169
+ #
1170
+ # source://console//lib/console/terminal/xterm.rb#65
1171
+ def style(foreground, background = T.unsafe(nil), *attributes); end
1172
+
1173
+ # The width of the terminal.
1174
+ #
1175
+ # source://console//lib/console/terminal/xterm.rb#55
1176
+ def width; end
1177
+ end
1178
+
1179
+ # XTerm attribute codes.
1180
+ #
1181
+ # source://console//lib/console/terminal/xterm.rb#29
1182
+ Console::Terminal::XTerm::ATTRIBUTES = T.let(T.unsafe(nil), Hash)
1183
+
1184
+ # XTerm color codes.
1185
+ #
1186
+ # source://console//lib/console/terminal/xterm.rb#16
1187
+ Console::Terminal::XTerm::COLORS = T.let(T.unsafe(nil), Hash)
1188
+
1189
+ # source://console//lib/console/filter.rb#10
1190
+ Console::UNKNOWN = T.let(T.unsafe(nil), Symbol)
1191
+
1192
+ # source://console//lib/console/version.rb#7
1193
+ Console::VERSION = T.let(T.unsafe(nil), String)