roast-ai 0.4.6 → 0.4.8

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 (286) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yaml +3 -1
  3. data/.gitignore +7 -0
  4. data/.rubocop.yml +14 -0
  5. data/Gemfile +2 -1
  6. data/Gemfile.lock +9 -1
  7. data/Rakefile +16 -4
  8. data/examples/README.md +9 -0
  9. data/examples/available_tools_demo/workflow.yml +2 -2
  10. data/examples/basic_prompt_workflow/workflow.md +1 -0
  11. data/examples/basic_prompt_workflow/workflow.yml +14 -0
  12. data/lib/roast/dsl/executor.rb +2 -1
  13. data/lib/roast/helpers/cmd_runner.rb +199 -0
  14. data/lib/roast/initializers.rb +1 -1
  15. data/lib/roast/tools/apply_diff.rb +1 -1
  16. data/lib/roast/tools/bash.rb +4 -4
  17. data/lib/roast/tools/cmd.rb +3 -5
  18. data/lib/roast/tools/coding_agent.rb +1 -1
  19. data/lib/roast/tools/grep.rb +6 -2
  20. data/lib/roast/tools/read_file.rb +2 -1
  21. data/lib/roast/tools/swarm.rb +2 -7
  22. data/lib/roast/tools.rb +10 -1
  23. data/lib/roast/version.rb +1 -1
  24. data/lib/roast/workflow/base_step.rb +2 -3
  25. data/lib/roast/workflow/command_executor.rb +3 -3
  26. data/lib/roast/workflow/resource_resolver.rb +1 -1
  27. data/lib/roast/workflow/shell_script_step.rb +1 -1
  28. data/lib/roast/workflow/step_loader.rb +2 -7
  29. data/lib/roast.rb +7 -1
  30. data/rubocop/cop/roast/use_cmd_runner.rb +93 -0
  31. data/rubocop/cop/roast.rb +4 -0
  32. data/sorbet/rbi/gems/docile@1.4.1.rbi +377 -0
  33. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +233 -2
  34. data/sorbet/rbi/gems/racc@1.8.1.rbi +6 -4
  35. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +396 -2
  36. data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +3788 -2
  37. data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +7747 -2
  38. data/sorbet/rbi/gems/rubocop-sorbet@0.10.5.rbi +2386 -0
  39. data/sorbet/rbi/gems/rubocop@1.77.0.rbi +62813 -2
  40. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +1311 -2
  41. data/sorbet/rbi/gems/simplecov-html@0.13.2.rbi +225 -0
  42. data/sorbet/rbi/gems/simplecov@0.22.0.rbi +2259 -0
  43. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +9 -0
  44. data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +125 -2
  45. data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +244 -2
  46. data/sorbet/tapioca/require.rb +2 -1
  47. metadata +12 -240
  48. data/CHANGELOG.md +0 -364
  49. data/examples/agent_continue/add_documentation/prompt.md +0 -5
  50. data/examples/agent_continue/add_error_handling/prompt.md +0 -5
  51. data/examples/agent_continue/analyze_codebase/prompt.md +0 -7
  52. data/examples/agent_continue/combined_workflow.yml +0 -24
  53. data/examples/agent_continue/continue_adding_features/prompt.md +0 -4
  54. data/examples/agent_continue/create_integration_tests/prompt.md +0 -3
  55. data/examples/agent_continue/document_with_context/prompt.md +0 -5
  56. data/examples/agent_continue/explore_api/prompt.md +0 -6
  57. data/examples/agent_continue/implement_client/prompt.md +0 -6
  58. data/examples/agent_continue/inline_workflow.yml +0 -20
  59. data/examples/agent_continue/refactor_code/prompt.md +0 -2
  60. data/examples/agent_continue/verify_changes/prompt.md +0 -6
  61. data/examples/agent_continue/workflow.yml +0 -27
  62. data/examples/agent_workflow/README.md +0 -75
  63. data/examples/agent_workflow/apply_refactorings/prompt.md +0 -22
  64. data/examples/agent_workflow/identify_code_smells/prompt.md +0 -15
  65. data/examples/agent_workflow/summarize_improvements/prompt.md +0 -18
  66. data/examples/agent_workflow/workflow.png +0 -0
  67. data/examples/agent_workflow/workflow.yml +0 -16
  68. data/examples/api_workflow/README.md +0 -85
  69. data/examples/api_workflow/fetch_api_data/prompt.md +0 -10
  70. data/examples/api_workflow/generate_report/prompt.md +0 -10
  71. data/examples/api_workflow/prompt.md +0 -10
  72. data/examples/api_workflow/transform_data/prompt.md +0 -10
  73. data/examples/api_workflow/workflow.png +0 -0
  74. data/examples/api_workflow/workflow.yml +0 -30
  75. data/examples/apply_diff_demo/README.md +0 -58
  76. data/examples/apply_diff_demo/apply_simple_change/prompt.md +0 -13
  77. data/examples/apply_diff_demo/create_sample_file/prompt.md +0 -11
  78. data/examples/apply_diff_demo/workflow.yml +0 -24
  79. data/examples/available_tools_demo/workflow.png +0 -0
  80. data/examples/bash_prototyping/README.md +0 -53
  81. data/examples/bash_prototyping/analyze_network/prompt.md +0 -13
  82. data/examples/bash_prototyping/analyze_system/prompt.md +0 -11
  83. data/examples/bash_prototyping/api_testing.png +0 -0
  84. data/examples/bash_prototyping/api_testing.yml +0 -14
  85. data/examples/bash_prototyping/check_processes/prompt.md +0 -11
  86. data/examples/bash_prototyping/generate_report/prompt.md +0 -16
  87. data/examples/bash_prototyping/process_json_response/prompt.md +0 -24
  88. data/examples/bash_prototyping/system_analysis.png +0 -0
  89. data/examples/bash_prototyping/system_analysis.yml +0 -14
  90. data/examples/bash_prototyping/test_public_api/prompt.md +0 -22
  91. data/examples/case_when/README.md +0 -58
  92. data/examples/case_when/detect_language/prompt.md +0 -16
  93. data/examples/case_when/workflow.png +0 -0
  94. data/examples/case_when/workflow.yml +0 -58
  95. data/examples/cmd/README.md +0 -99
  96. data/examples/cmd/analyze_project/prompt.md +0 -57
  97. data/examples/cmd/basic_demo/prompt.md +0 -48
  98. data/examples/cmd/basic_workflow.png +0 -0
  99. data/examples/cmd/basic_workflow.yml +0 -17
  100. data/examples/cmd/check_repository/prompt.md +0 -57
  101. data/examples/cmd/create_and_verify/prompt.md +0 -56
  102. data/examples/cmd/dev_workflow.png +0 -0
  103. data/examples/cmd/dev_workflow.yml +0 -26
  104. data/examples/cmd/explore_project/prompt.md +0 -67
  105. data/examples/cmd/explorer_workflow.png +0 -0
  106. data/examples/cmd/explorer_workflow.yml +0 -21
  107. data/examples/cmd/smart_tool_selection/prompt.md +0 -99
  108. data/examples/coding_agent_with_model.yml +0 -20
  109. data/examples/coding_agent_with_retries.yml +0 -30
  110. data/examples/conditional/README.md +0 -161
  111. data/examples/conditional/check_condition/prompt.md +0 -1
  112. data/examples/conditional/simple_workflow.png +0 -0
  113. data/examples/conditional/simple_workflow.yml +0 -15
  114. data/examples/conditional/workflow.png +0 -0
  115. data/examples/conditional/workflow.yml +0 -23
  116. data/examples/context_management_demo/README.md +0 -43
  117. data/examples/context_management_demo/workflow.yml +0 -42
  118. data/examples/direct_coerce_syntax/README.md +0 -32
  119. data/examples/direct_coerce_syntax/workflow.png +0 -0
  120. data/examples/direct_coerce_syntax/workflow.yml +0 -36
  121. data/examples/dot_notation/README.md +0 -37
  122. data/examples/dot_notation/workflow.png +0 -0
  123. data/examples/dot_notation/workflow.yml +0 -44
  124. data/examples/exit_on_error/README.md +0 -50
  125. data/examples/exit_on_error/analyze_lint_output/prompt.md +0 -9
  126. data/examples/exit_on_error/apply_fixes/prompt.md +0 -2
  127. data/examples/exit_on_error/workflow.png +0 -0
  128. data/examples/exit_on_error/workflow.yml +0 -19
  129. data/examples/grading/README.md +0 -71
  130. data/examples/grading/analyze_coverage/prompt.md +0 -52
  131. data/examples/grading/calculate_final_grade.rb +0 -67
  132. data/examples/grading/format_result.rb +0 -64
  133. data/examples/grading/generate_grades/prompt.md +0 -105
  134. data/examples/grading/generate_recommendations/output.txt +0 -17
  135. data/examples/grading/generate_recommendations/prompt.md +0 -60
  136. data/examples/grading/js_test_runner +0 -31
  137. data/examples/grading/rb_test_runner +0 -19
  138. data/examples/grading/read_dependencies/prompt.md +0 -16
  139. data/examples/grading/run_coverage.rb +0 -54
  140. data/examples/grading/verify_mocks_and_stubs/prompt.md +0 -12
  141. data/examples/grading/verify_test_helpers/prompt.md +0 -53
  142. data/examples/grading/workflow.md +0 -8
  143. data/examples/grading/workflow.png +0 -0
  144. data/examples/grading/workflow.rb.md +0 -6
  145. data/examples/grading/workflow.ts+tsx.md +0 -6
  146. data/examples/grading/workflow.yml +0 -41
  147. data/examples/instrumentation.rb +0 -76
  148. data/examples/interpolation/README.md +0 -50
  149. data/examples/interpolation/analyze_file/prompt.md +0 -1
  150. data/examples/interpolation/analyze_patterns/prompt.md +0 -27
  151. data/examples/interpolation/generate_report_for_js/prompt.md +0 -3
  152. data/examples/interpolation/generate_report_for_rb/prompt.md +0 -3
  153. data/examples/interpolation/sample.js +0 -48
  154. data/examples/interpolation/sample.rb +0 -42
  155. data/examples/interpolation/workflow.md +0 -1
  156. data/examples/interpolation/workflow.png +0 -0
  157. data/examples/interpolation/workflow.yml +0 -21
  158. data/examples/iteration/IMPLEMENTATION.md +0 -88
  159. data/examples/iteration/README.md +0 -68
  160. data/examples/iteration/analyze_complexity/prompt.md +0 -22
  161. data/examples/iteration/generate_recommendations/prompt.md +0 -21
  162. data/examples/iteration/generate_report/prompt.md +0 -129
  163. data/examples/iteration/implement_fix/prompt.md +0 -25
  164. data/examples/iteration/prioritize_issues/prompt.md +0 -24
  165. data/examples/iteration/prompts/analyze_file.md +0 -28
  166. data/examples/iteration/prompts/generate_summary.md +0 -24
  167. data/examples/iteration/prompts/update_report.md +0 -29
  168. data/examples/iteration/prompts/write_report.md +0 -22
  169. data/examples/iteration/read_file/prompt.md +0 -9
  170. data/examples/iteration/select_next_issue/prompt.md +0 -25
  171. data/examples/iteration/simple_workflow.md +0 -39
  172. data/examples/iteration/simple_workflow.yml +0 -58
  173. data/examples/iteration/update_fix_count/prompt.md +0 -26
  174. data/examples/iteration/verify_fix/prompt.md +0 -29
  175. data/examples/iteration/workflow.png +0 -0
  176. data/examples/iteration/workflow.yml +0 -42
  177. data/examples/json_handling/README.md +0 -32
  178. data/examples/json_handling/workflow.png +0 -0
  179. data/examples/json_handling/workflow.yml +0 -52
  180. data/examples/mcp/README.md +0 -223
  181. data/examples/mcp/analyze_changes/prompt.md +0 -8
  182. data/examples/mcp/analyze_issues/prompt.md +0 -4
  183. data/examples/mcp/analyze_schema/prompt.md +0 -4
  184. data/examples/mcp/check_data_quality/prompt.md +0 -5
  185. data/examples/mcp/check_documentation/prompt.md +0 -4
  186. data/examples/mcp/create_recommendations/prompt.md +0 -5
  187. data/examples/mcp/database_workflow.png +0 -0
  188. data/examples/mcp/database_workflow.yml +0 -29
  189. data/examples/mcp/env_demo/workflow.png +0 -0
  190. data/examples/mcp/env_demo/workflow.yml +0 -34
  191. data/examples/mcp/fetch_pr_context/prompt.md +0 -4
  192. data/examples/mcp/filesystem_demo/create_test_file/prompt.md +0 -2
  193. data/examples/mcp/filesystem_demo/list_files/prompt.md +0 -6
  194. data/examples/mcp/filesystem_demo/read_with_mcp/prompt.md +0 -7
  195. data/examples/mcp/filesystem_demo/workflow.png +0 -0
  196. data/examples/mcp/filesystem_demo/workflow.yml +0 -38
  197. data/examples/mcp/generate_insights/prompt.md +0 -4
  198. data/examples/mcp/generate_report/prompt.md +0 -6
  199. data/examples/mcp/generate_review/prompt.md +0 -16
  200. data/examples/mcp/github_workflow.png +0 -0
  201. data/examples/mcp/github_workflow.yml +0 -32
  202. data/examples/mcp/multi_mcp_workflow.png +0 -0
  203. data/examples/mcp/multi_mcp_workflow.yml +0 -58
  204. data/examples/mcp/post_review/prompt.md +0 -3
  205. data/examples/mcp/save_report/prompt.md +0 -6
  206. data/examples/mcp/search_issues/prompt.md +0 -2
  207. data/examples/mcp/summarize/prompt.md +0 -1
  208. data/examples/mcp/test_filesystem/prompt.md +0 -6
  209. data/examples/mcp/test_github/prompt.md +0 -8
  210. data/examples/mcp/test_read/prompt.md +0 -1
  211. data/examples/mcp/workflow.png +0 -0
  212. data/examples/mcp/workflow.yml +0 -35
  213. data/examples/no_model_fallback/README.md +0 -17
  214. data/examples/no_model_fallback/analyze_file/prompt.md +0 -1
  215. data/examples/no_model_fallback/analyze_patterns/prompt.md +0 -27
  216. data/examples/no_model_fallback/generate_report_for_md/prompt.md +0 -10
  217. data/examples/no_model_fallback/generate_report_for_rb/prompt.md +0 -3
  218. data/examples/no_model_fallback/sample.rb +0 -42
  219. data/examples/no_model_fallback/workflow.yml +0 -19
  220. data/examples/openrouter_example/README.md +0 -48
  221. data/examples/openrouter_example/analyze_input/prompt.md +0 -16
  222. data/examples/openrouter_example/generate_response/prompt.md +0 -9
  223. data/examples/openrouter_example/workflow.png +0 -0
  224. data/examples/openrouter_example/workflow.yml +0 -12
  225. data/examples/pre_post_processing/README.md +0 -111
  226. data/examples/pre_post_processing/analyze_test_file/prompt.md +0 -23
  227. data/examples/pre_post_processing/improve_test_coverage/prompt.md +0 -17
  228. data/examples/pre_post_processing/optimize_test_performance/prompt.md +0 -25
  229. data/examples/pre_post_processing/post_processing/aggregate_metrics/prompt.md +0 -31
  230. data/examples/pre_post_processing/post_processing/cleanup_environment/prompt.md +0 -28
  231. data/examples/pre_post_processing/post_processing/generate_summary_report/prompt.md +0 -32
  232. data/examples/pre_post_processing/post_processing/output.txt +0 -24
  233. data/examples/pre_post_processing/pre_processing/gather_baseline_metrics/prompt.md +0 -26
  234. data/examples/pre_post_processing/pre_processing/setup_test_environment/prompt.md +0 -11
  235. data/examples/pre_post_processing/validate_changes/prompt.md +0 -24
  236. data/examples/pre_post_processing/workflow.png +0 -0
  237. data/examples/pre_post_processing/workflow.yml +0 -21
  238. data/examples/retry/workflow.yml +0 -23
  239. data/examples/rspec_to_minitest/README.md +0 -68
  240. data/examples/rspec_to_minitest/analyze_spec/prompt.md +0 -30
  241. data/examples/rspec_to_minitest/create_minitest/prompt.md +0 -33
  242. data/examples/rspec_to_minitest/run_and_improve/prompt.md +0 -35
  243. data/examples/rspec_to_minitest/workflow.md +0 -10
  244. data/examples/rspec_to_minitest/workflow.png +0 -0
  245. data/examples/rspec_to_minitest/workflow.yml +0 -40
  246. data/examples/shared_config/README.md +0 -52
  247. data/examples/shared_config/example_with_shared_config/workflow.png +0 -0
  248. data/examples/shared_config/example_with_shared_config/workflow.yml +0 -6
  249. data/examples/shared_config/shared.png +0 -0
  250. data/examples/shared_config/shared.yml +0 -7
  251. data/examples/single_target_prepost/README.md +0 -36
  252. data/examples/single_target_prepost/post_processing/output.txt +0 -27
  253. data/examples/single_target_prepost/pre_processing/gather_dependencies/prompt.md +0 -11
  254. data/examples/single_target_prepost/workflow.png +0 -0
  255. data/examples/single_target_prepost/workflow.yml +0 -20
  256. data/examples/smart_coercion_defaults/README.md +0 -65
  257. data/examples/smart_coercion_defaults/workflow.png +0 -0
  258. data/examples/smart_coercion_defaults/workflow.yml +0 -44
  259. data/examples/step_configuration/README.md +0 -84
  260. data/examples/step_configuration/workflow.png +0 -0
  261. data/examples/step_configuration/workflow.yml +0 -57
  262. data/examples/swarm_example.yml +0 -25
  263. data/examples/tool_config_example/README.md +0 -109
  264. data/examples/tool_config_example/example_step/prompt.md +0 -42
  265. data/examples/tool_config_example/workflow.png +0 -0
  266. data/examples/tool_config_example/workflow.yml +0 -17
  267. data/examples/user_input/README.md +0 -90
  268. data/examples/user_input/funny_name/create_backstory/prompt.md +0 -10
  269. data/examples/user_input/funny_name/workflow.png +0 -0
  270. data/examples/user_input/funny_name/workflow.yml +0 -26
  271. data/examples/user_input/generate_summary/prompt.md +0 -11
  272. data/examples/user_input/simple_input_demo/workflow.png +0 -0
  273. data/examples/user_input/simple_input_demo/workflow.yml +0 -35
  274. data/examples/user_input/survey_workflow.png +0 -0
  275. data/examples/user_input/survey_workflow.yml +0 -71
  276. data/examples/user_input/welcome_message/prompt.md +0 -3
  277. data/examples/user_input/workflow.png +0 -0
  278. data/examples/user_input/workflow.yml +0 -73
  279. data/examples/workflow_generator/README.md +0 -27
  280. data/examples/workflow_generator/analyze_user_request/prompt.md +0 -34
  281. data/examples/workflow_generator/create_workflow_files/prompt.md +0 -32
  282. data/examples/workflow_generator/get_user_input/prompt.md +0 -14
  283. data/examples/workflow_generator/info_from_roast.rb +0 -22
  284. data/examples/workflow_generator/workflow.png +0 -0
  285. data/examples/workflow_generator/workflow.yml +0 -34
  286. data/lib/roast/helpers/timeout_handler.rb +0 -89
data/lib/roast.rb CHANGED
@@ -21,6 +21,7 @@ require "yaml"
21
21
  # Third-party gem requires
22
22
  require "active_support"
23
23
  require "active_support/cache"
24
+ require "active_support/core_ext/array"
24
25
  require "active_support/core_ext/hash/indifferent_access"
25
26
  require "active_support/core_ext/module/delegation"
26
27
  require "active_support/core_ext/string"
@@ -36,6 +37,7 @@ require "raix/chat_completion"
36
37
  require "raix/function_dispatch"
37
38
  require "ruby-graphviz"
38
39
  require "thor"
40
+ require "timeout"
39
41
 
40
42
  # Autoloading setup
41
43
  require "zeitwerk"
@@ -326,7 +328,11 @@ module Roast
326
328
  def copy_example(example_name)
327
329
  examples_dir = File.join(Roast::ROOT, "examples")
328
330
  source_path = File.join(examples_dir, example_name)
329
- target_path = File.join(Dir.pwd, example_name)
331
+
332
+ # Always place new workflows in roast/ so `roast list` can find them
333
+ roast_dir = File.join(Dir.pwd, "roast")
334
+ FileUtils.mkdir_p(roast_dir)
335
+ target_path = File.join(roast_dir, example_name)
330
336
 
331
337
  unless File.directory?(source_path)
332
338
  puts "Example '#{example_name}' not found!"
@@ -0,0 +1,93 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ module RuboCop
5
+ module Cop
6
+ module Roast
7
+ # This cop suggests using CmdRunner instead of other command execution methods
8
+ #
9
+ # @example
10
+ # # bad
11
+ # `ls -la`
12
+ # %x(ls -la)
13
+ # system("ls -la")
14
+ # Open3.capture3("ls -la")
15
+ # spawn("ls -la")
16
+ # exec("ls -la")
17
+ #
18
+ # # good
19
+ # CmdRunner.capture3("ls -la")
20
+ # CmdRunner.capture2e("ls -la")
21
+ class UseCmdRunner < RuboCop::Cop::Base
22
+ MSG = "Use `CmdRunner` instead of `%<method>s` for command execution to ensure proper process tracking and cleanup"
23
+
24
+ # Pattern for backtick commands
25
+ def_node_matcher :backtick_command?, <<~PATTERN
26
+ (xstr ...)
27
+ PATTERN
28
+
29
+ # Pattern for %x() commands
30
+ def_node_matcher :percent_x_command?, <<~PATTERN
31
+ (xstr ...)
32
+ PATTERN
33
+
34
+ # Pattern for system() calls
35
+ def_node_matcher :system_call?, <<~PATTERN
36
+ (send nil? :system ...)
37
+ PATTERN
38
+
39
+ # Pattern for spawn() calls
40
+ def_node_matcher :spawn_call?, <<~PATTERN
41
+ (send nil? :spawn ...)
42
+ PATTERN
43
+
44
+ # Pattern for exec() calls
45
+ def_node_matcher :exec_call?, <<~PATTERN
46
+ (send nil? :exec ...)
47
+ PATTERN
48
+
49
+ # Pattern for Open3 methods
50
+ def_node_matcher :open3_call?, <<~PATTERN
51
+ (send (const nil? :Open3) {:capture2 :capture2e :capture3 :popen2 :popen2e :popen3} ...)
52
+ PATTERN
53
+
54
+ # Pattern for Process.spawn
55
+ def_node_matcher :process_spawn?, <<~PATTERN
56
+ (send (const nil? :Process) :spawn ...)
57
+ PATTERN
58
+
59
+ # Pattern for Kernel methods
60
+ def_node_matcher :kernel_system?, <<~PATTERN
61
+ (send (const nil? :Kernel) {:system :spawn :exec} ...)
62
+ PATTERN
63
+
64
+ # Pattern for IO.popen
65
+ def_node_matcher :io_popen?, <<~PATTERN
66
+ (send (const nil? :IO) :popen ...)
67
+ PATTERN
68
+
69
+ def on_xstr(node)
70
+ add_offense(node, message: format(MSG, method: "backticks"))
71
+ end
72
+
73
+ def on_send(node)
74
+ if system_call?(node) || kernel_system?(node)
75
+ method_name = node.method_name
76
+ add_offense(node, message: format(MSG, method: method_name))
77
+ elsif spawn_call?(node)
78
+ add_offense(node, message: format(MSG, method: "spawn"))
79
+ elsif exec_call?(node)
80
+ add_offense(node, message: format(MSG, method: "exec"))
81
+ elsif open3_call?(node)
82
+ method_name = "Open3.#{node.method_name}"
83
+ add_offense(node, message: format(MSG, method: method_name))
84
+ elsif process_spawn?(node)
85
+ add_offense(node, message: format(MSG, method: "Process.spawn"))
86
+ elsif io_popen?(node)
87
+ add_offense(node, message: format(MSG, method: "IO.popen"))
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,4 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "roast/use_cmd_runner"
@@ -0,0 +1,377 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `docile` gem.
5
+ # Please instead update this file by running `bin/tapioca gem docile`.
6
+
7
+
8
+ # Docile keeps your Ruby DSLs tame and well-behaved.
9
+ #
10
+ # source://docile//lib/docile/version.rb#3
11
+ module Docile
12
+ extend ::Docile::Execution
13
+
14
+ private
15
+
16
+ # Execute a block in the context of an object whose methods represent the
17
+ # commands in a DSL.
18
+ #
19
+ # Use this method to execute an *imperative* DSL, which means that:
20
+ #
21
+ # 1. Each command mutates the state of the DSL context object
22
+ # 2. The return value of each command is ignored
23
+ # 3. The final return value is the original context object
24
+ #
25
+ # @example Use a String as a DSL
26
+ # Docile.dsl_eval("Hello, world!") do
27
+ # reverse!
28
+ # upcase!
29
+ # end
30
+ # #=> "!DLROW ,OLLEH"
31
+ # @example Use an Array as a DSL
32
+ # Docile.dsl_eval([]) do
33
+ # push 1
34
+ # push 2
35
+ # pop
36
+ # push 3
37
+ # end
38
+ # #=> [1, 3]
39
+ # @note Use with an *imperative* DSL (commands modify the context object)
40
+ # @param dsl [Object] context object whose methods make up the DSL
41
+ # @param args [Array] arguments to be passed to the block
42
+ # @param block [Proc] the block of DSL commands to be executed against the
43
+ # `dsl` context object
44
+ # @return [Object] the `dsl` context object after executing the block
45
+ #
46
+ # source://docile//lib/docile.rb#45
47
+ def dsl_eval(dsl, *args, **_arg2, &block); end
48
+
49
+ # Execute a block in the context of an immutable object whose methods,
50
+ # and the methods of their return values, represent the commands in a DSL.
51
+ #
52
+ # Use this method to execute a *functional* DSL, which means that:
53
+ #
54
+ # 1. The original DSL context object is never mutated
55
+ # 2. Each command returns the next DSL context object
56
+ # 3. The final return value is the value returned by the last command
57
+ #
58
+ # @example Use a frozen String as a DSL
59
+ # Docile.dsl_eval_immutable("I'm immutable!".freeze) do
60
+ # reverse
61
+ # upcase
62
+ # end
63
+ # #=> "!ELBATUMMI M'I"
64
+ # @example Use a Float as a DSL
65
+ # Docile.dsl_eval_immutable(84.5) do
66
+ # fdiv(2)
67
+ # floor
68
+ # end
69
+ # #=> 42
70
+ # @note Use with a *functional* DSL (commands return successor
71
+ # context objects)
72
+ # @param dsl [Object] immutable context object whose methods make up the
73
+ # initial DSL
74
+ # @param args [Array] arguments to be passed to the block
75
+ # @param block [Proc] the block of DSL commands to be executed against the
76
+ # `dsl` context object and successor return values
77
+ # @return [Object] the return value of the final command in the block
78
+ #
79
+ # source://docile//lib/docile.rb#128
80
+ def dsl_eval_immutable(dsl, *args, **_arg2, &block); end
81
+
82
+ # Execute a block in the context of an object whose methods represent the
83
+ # commands in a DSL, and return *the block's return value*.
84
+ #
85
+ # Use this method to execute an *imperative* DSL, which means that:
86
+ #
87
+ # 1. Each command mutates the state of the DSL context object
88
+ # 2. The return value of each command is ignored
89
+ # 3. The final return value is the original context object
90
+ #
91
+ # @example Use a String as a DSL
92
+ # Docile.dsl_eval_with_block_return("Hello, world!") do
93
+ # reverse!
94
+ # upcase!
95
+ # first
96
+ # end
97
+ # #=> "!"
98
+ # @example Use an Array as a DSL
99
+ # Docile.dsl_eval_with_block_return([]) do
100
+ # push "a"
101
+ # push "b"
102
+ # pop
103
+ # push "c"
104
+ # length
105
+ # end
106
+ # #=> 2
107
+ # @note Use with an *imperative* DSL (commands modify the context object)
108
+ # @param dsl [Object] context object whose methods make up the DSL
109
+ # @param args [Array] arguments to be passed to the block
110
+ # @param block [Proc] the block of DSL commands to be executed against the
111
+ # `dsl` context object
112
+ # @return [Object] the return value from executing the block
113
+ #
114
+ # source://docile//lib/docile.rb#87
115
+ def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end
116
+
117
+ class << self
118
+ # Execute a block in the context of an object whose methods represent the
119
+ # commands in a DSL.
120
+ #
121
+ # Use this method to execute an *imperative* DSL, which means that:
122
+ #
123
+ # 1. Each command mutates the state of the DSL context object
124
+ # 2. The return value of each command is ignored
125
+ # 3. The final return value is the original context object
126
+ #
127
+ # @example Use a String as a DSL
128
+ # Docile.dsl_eval("Hello, world!") do
129
+ # reverse!
130
+ # upcase!
131
+ # end
132
+ # #=> "!DLROW ,OLLEH"
133
+ # @example Use an Array as a DSL
134
+ # Docile.dsl_eval([]) do
135
+ # push 1
136
+ # push 2
137
+ # pop
138
+ # push 3
139
+ # end
140
+ # #=> [1, 3]
141
+ # @note Use with an *imperative* DSL (commands modify the context object)
142
+ # @param dsl [Object] context object whose methods make up the DSL
143
+ # @param args [Array] arguments to be passed to the block
144
+ # @param block [Proc] the block of DSL commands to be executed against the
145
+ # `dsl` context object
146
+ # @return [Object] the `dsl` context object after executing the block
147
+ #
148
+ # source://docile//lib/docile.rb#45
149
+ def dsl_eval(dsl, *args, **_arg2, &block); end
150
+
151
+ # Execute a block in the context of an immutable object whose methods,
152
+ # and the methods of their return values, represent the commands in a DSL.
153
+ #
154
+ # Use this method to execute a *functional* DSL, which means that:
155
+ #
156
+ # 1. The original DSL context object is never mutated
157
+ # 2. Each command returns the next DSL context object
158
+ # 3. The final return value is the value returned by the last command
159
+ #
160
+ # @example Use a frozen String as a DSL
161
+ # Docile.dsl_eval_immutable("I'm immutable!".freeze) do
162
+ # reverse
163
+ # upcase
164
+ # end
165
+ # #=> "!ELBATUMMI M'I"
166
+ # @example Use a Float as a DSL
167
+ # Docile.dsl_eval_immutable(84.5) do
168
+ # fdiv(2)
169
+ # floor
170
+ # end
171
+ # #=> 42
172
+ # @note Use with a *functional* DSL (commands return successor
173
+ # context objects)
174
+ # @param dsl [Object] immutable context object whose methods make up the
175
+ # initial DSL
176
+ # @param args [Array] arguments to be passed to the block
177
+ # @param block [Proc] the block of DSL commands to be executed against the
178
+ # `dsl` context object and successor return values
179
+ # @return [Object] the return value of the final command in the block
180
+ #
181
+ # source://docile//lib/docile.rb#128
182
+ def dsl_eval_immutable(dsl, *args, **_arg2, &block); end
183
+
184
+ # Execute a block in the context of an object whose methods represent the
185
+ # commands in a DSL, and return *the block's return value*.
186
+ #
187
+ # Use this method to execute an *imperative* DSL, which means that:
188
+ #
189
+ # 1. Each command mutates the state of the DSL context object
190
+ # 2. The return value of each command is ignored
191
+ # 3. The final return value is the original context object
192
+ #
193
+ # @example Use a String as a DSL
194
+ # Docile.dsl_eval_with_block_return("Hello, world!") do
195
+ # reverse!
196
+ # upcase!
197
+ # first
198
+ # end
199
+ # #=> "!"
200
+ # @example Use an Array as a DSL
201
+ # Docile.dsl_eval_with_block_return([]) do
202
+ # push "a"
203
+ # push "b"
204
+ # pop
205
+ # push "c"
206
+ # length
207
+ # end
208
+ # #=> 2
209
+ # @note Use with an *imperative* DSL (commands modify the context object)
210
+ # @param dsl [Object] context object whose methods make up the DSL
211
+ # @param args [Array] arguments to be passed to the block
212
+ # @param block [Proc] the block of DSL commands to be executed against the
213
+ # `dsl` context object
214
+ # @return [Object] the return value from executing the block
215
+ #
216
+ # source://docile//lib/docile.rb#87
217
+ def dsl_eval_with_block_return(dsl, *args, **_arg2, &block); end
218
+ end
219
+ end
220
+
221
+ # This is used to remove entries pointing to Docile's source files
222
+ # from {Exception#backtrace} and {Exception#backtrace_locations}.
223
+ #
224
+ # If {NoMethodError} is caught then the exception object will be extended
225
+ # by this module to add filter functionalities.
226
+ #
227
+ # @api private
228
+ #
229
+ # source://docile//lib/docile/backtrace_filter.rb#11
230
+ module Docile::BacktraceFilter
231
+ # @api private
232
+ #
233
+ # source://docile//lib/docile/backtrace_filter.rb#14
234
+ def backtrace; end
235
+
236
+ # @api private
237
+ #
238
+ # source://docile//lib/docile/backtrace_filter.rb#19
239
+ def backtrace_locations; end
240
+ end
241
+
242
+ # @api private
243
+ #
244
+ # source://docile//lib/docile/backtrace_filter.rb#12
245
+ Docile::BacktraceFilter::FILTER_PATTERN = T.let(T.unsafe(nil), Regexp)
246
+
247
+ # Operates in the same manner as {FallbackContextProxy}, but replacing
248
+ # the primary `receiver` object with the result of each proxied method.
249
+ #
250
+ # This is useful for implementing DSL evaluation for immutable context
251
+ # objects.
252
+ #
253
+ #
254
+ # @api private
255
+ # @see Docile.dsl_eval_immutable
256
+ #
257
+ # source://docile//lib/docile/chaining_fallback_context_proxy.rb#17
258
+ class Docile::ChainingFallbackContextProxy < ::Docile::FallbackContextProxy
259
+ # Proxy methods as in {FallbackContextProxy#method_missing}, replacing
260
+ # `receiver` with the returned value.
261
+ #
262
+ # @api private
263
+ #
264
+ # source://docile//lib/docile/chaining_fallback_context_proxy.rb#20
265
+ def method_missing(method, *args, **_arg2, &block); end
266
+ end
267
+
268
+ # A namespace for functions relating to the execution of a block against a
269
+ # proxy object.
270
+ #
271
+ # @api private
272
+ #
273
+ # source://docile//lib/docile/execution.rb#8
274
+ module Docile::Execution
275
+ private
276
+
277
+ # Execute a block in the context of an object whose methods represent the
278
+ # commands in a DSL, using a specific proxy class.
279
+ #
280
+ # @api private
281
+ # @param dsl [Object] context object whose methods make up the
282
+ # (initial) DSL
283
+ # @param proxy_type [FallbackContextProxy, ChainingFallbackContextProxy] which class to instantiate as proxy context
284
+ # @param args [Array] arguments to be passed to the block
285
+ # @param block [Proc] the block of DSL commands to be executed
286
+ # @return [Object] the return value of the block
287
+ #
288
+ # source://docile//lib/docile/execution.rb#19
289
+ def exec_in_proxy_context(dsl, proxy_type, *args, **_arg3, &block); end
290
+
291
+ class << self
292
+ # Execute a block in the context of an object whose methods represent the
293
+ # commands in a DSL, using a specific proxy class.
294
+ #
295
+ # @api private
296
+ # @param dsl [Object] context object whose methods make up the
297
+ # (initial) DSL
298
+ # @param proxy_type [FallbackContextProxy, ChainingFallbackContextProxy] which class to instantiate as proxy context
299
+ # @param args [Array] arguments to be passed to the block
300
+ # @param block [Proc] the block of DSL commands to be executed
301
+ # @return [Object] the return value of the block
302
+ #
303
+ # source://docile//lib/docile/execution.rb#19
304
+ def exec_in_proxy_context(dsl, proxy_type, *args, **_arg3, &block); end
305
+ end
306
+ end
307
+
308
+ # A proxy object with a primary receiver as well as a secondary
309
+ # fallback receiver.
310
+ #
311
+ # Will attempt to forward all method calls first to the primary receiver,
312
+ # and then to the fallback receiver if the primary does not handle that
313
+ # method.
314
+ #
315
+ # This is useful for implementing DSL evaluation in the context of an object.
316
+ #
317
+ #
318
+ # @api private
319
+ # @see Docile.dsl_eval
320
+ #
321
+ # source://docile//lib/docile/fallback_context_proxy.rb#20
322
+ class Docile::FallbackContextProxy
323
+ # @api private
324
+ # @param receiver [Object] the primary proxy target to which all methods
325
+ # initially will be forwarded
326
+ # @param fallback [Object] the fallback proxy target to which any methods
327
+ # not handled by `receiver` will be forwarded
328
+ # @return [FallbackContextProxy] a new instance of FallbackContextProxy
329
+ #
330
+ # source://docile//lib/docile/fallback_context_proxy.rb#46
331
+ def initialize(receiver, fallback); end
332
+
333
+ # @api private
334
+ # @return [Array<Symbol>] Instance variable names, excluding
335
+ # {NON_PROXIED_INSTANCE_VARIABLES}
336
+ #
337
+ # source://docile//lib/docile/fallback_context_proxy.rb#85
338
+ def instance_variables; end
339
+
340
+ # Proxy all methods, excluding {NON_PROXIED_METHODS}, first to `receiver`
341
+ # and then to `fallback` if not found.
342
+ #
343
+ # @api private
344
+ #
345
+ # source://docile//lib/docile/fallback_context_proxy.rb#91
346
+ def method_missing(method, *args, **_arg2, &block); end
347
+ end
348
+
349
+ # The set of methods which will **not** fallback from the block's context
350
+ # to the dsl object.
351
+ #
352
+ # @api private
353
+ #
354
+ # source://docile//lib/docile/fallback_context_proxy.rb#30
355
+ Docile::FallbackContextProxy::NON_FALLBACK_METHODS = T.let(T.unsafe(nil), Set)
356
+
357
+ # The set of instance variables which are local to this object and hidden.
358
+ # All other instance variables will be copied in and out of this object
359
+ # from the scope in which this proxy was created.
360
+ #
361
+ # @api private
362
+ #
363
+ # source://docile//lib/docile/fallback_context_proxy.rb#35
364
+ Docile::FallbackContextProxy::NON_PROXIED_INSTANCE_VARIABLES = T.let(T.unsafe(nil), Set)
365
+
366
+ # The set of methods which will **not** be proxied, but instead answered
367
+ # by this object directly.
368
+ #
369
+ # @api private
370
+ #
371
+ # source://docile//lib/docile/fallback_context_proxy.rb#23
372
+ Docile::FallbackContextProxy::NON_PROXIED_METHODS = T.let(T.unsafe(nil), Set)
373
+
374
+ # The current version of this library
375
+ #
376
+ # source://docile//lib/docile/version.rb#5
377
+ Docile::VERSION = T.let(T.unsafe(nil), String)