nukadoko 0.5.0 → 0.7.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 (203) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +553 -3
  3. data/README.ja.md +22 -6
  4. data/README.md +13 -7
  5. data/docs/ci.ja.md +542 -0
  6. data/docs/ci.md +635 -0
  7. data/docs/commands.ja.md +1524 -0
  8. data/docs/commands.md +1281 -0
  9. data/docs/engines.json +19 -0
  10. data/docs/execution-events.ja.md +336 -0
  11. data/docs/execution-events.md +423 -0
  12. data/docs/glossary.json +1348 -0
  13. data/docs/guide.ja.md +733 -0
  14. data/docs/guide.md +815 -0
  15. data/docs/intent.ja.md +133 -0
  16. data/docs/intent.md +156 -0
  17. data/docs/layout.ja.md +442 -0
  18. data/docs/layout.md +399 -0
  19. data/docs/releasing.ja.md +186 -0
  20. data/docs/releasing.md +237 -0
  21. data/docs/ruby/reference.ja.md +302 -0
  22. data/docs/ruby/reference.md +368 -0
  23. data/docs/spec.ja.md +8916 -0
  24. data/docs/spec.md +11250 -0
  25. data/docs/tutorial.ja.md +451 -0
  26. data/docs/tutorial.md +458 -0
  27. data/docs/typescript/adopting.ja.md +231 -0
  28. data/docs/typescript/adopting.md +251 -0
  29. data/docs/typescript/doors.ja.md +301 -0
  30. data/docs/typescript/doors.md +329 -0
  31. data/docs/typescript/migration-playwright-test.ja.md +189 -0
  32. data/docs/typescript/migration-playwright-test.md +212 -0
  33. data/docs/typescript/migration.ja.md +391 -0
  34. data/docs/typescript/migration.md +505 -0
  35. data/docs/typescript/reference.ja.md +176 -0
  36. data/docs/typescript/reference.md +197 -0
  37. data/docs/typescript/upgrading.ja.md +1774 -0
  38. data/docs/typescript/upgrading.md +2224 -0
  39. data/docs/web-app.ja.md +627 -0
  40. data/docs/web-app.md +659 -0
  41. data/docs/writing-scenarios.ja.md +544 -0
  42. data/docs/writing-scenarios.md +563 -0
  43. data/lib/nukadoko/base.rb +12 -5
  44. data/lib/nukadoko/changed_files.rb +95 -0
  45. data/lib/nukadoko/check.rb +459 -51
  46. data/lib/nukadoko/claim_drops.rb +271 -0
  47. data/lib/nukadoko/claim_line.rb +24 -4
  48. data/lib/nukadoko/claim_rules.rb +143 -1
  49. data/lib/nukadoko/claim_sides.rb +157 -9
  50. data/lib/nukadoko/cli.rb +403 -50
  51. data/lib/nukadoko/codes.json +246 -21
  52. data/lib/nukadoko/codes.rb +21 -4
  53. data/lib/nukadoko/command.rb +120 -13
  54. data/lib/nukadoko/command_help.rb +128 -0
  55. data/lib/nukadoko/compat.rb +469 -0
  56. data/lib/nukadoko/criteria.rb +1 -1
  57. data/lib/nukadoko/definition.rb +157 -7
  58. data/lib/nukadoko/error_frames.rb +6 -3
  59. data/lib/nukadoko/events/count.rb +146 -0
  60. data/lib/nukadoko/events/counted.rb +114 -0
  61. data/lib/nukadoko/events/format.rb +257 -0
  62. data/lib/nukadoko/events/lists.rb +154 -0
  63. data/lib/nukadoko/events/path.rb +285 -0
  64. data/lib/nukadoko/events/read.rb +284 -0
  65. data/lib/nukadoko/events/reader.rb +490 -0
  66. data/lib/nukadoko/events/selection.rb +252 -0
  67. data/lib/nukadoko/events/tally.rb +438 -0
  68. data/lib/nukadoko/features.rb +2 -2
  69. data/lib/nukadoko/fixtures.rb +160 -35
  70. data/lib/nukadoko/http_recording.rb +6 -2
  71. data/lib/nukadoko/intent.rb +364 -0
  72. data/lib/nukadoko/intent_file.rb +81 -0
  73. data/lib/nukadoko/intent_view.rb +190 -0
  74. data/lib/nukadoko/js_json.rb +2 -1
  75. data/lib/nukadoko/judge.rb +2 -2
  76. data/lib/nukadoko/judgment_file.rb +22 -1
  77. data/lib/nukadoko/judgments.rb +33 -3
  78. data/lib/nukadoko/measure_mcp.rb +202 -0
  79. data/lib/nukadoko/parts.rb +8 -2
  80. data/lib/nukadoko/path_view.rb +252 -0
  81. data/lib/nukadoko/place_rows.rb +161 -0
  82. data/lib/nukadoko/program.rb +1265 -51
  83. data/lib/nukadoko/program_log.rb +122 -0
  84. data/lib/nukadoko/program_shape.rb +385 -0
  85. data/lib/nukadoko/project_fixtures.rb +43 -10
  86. data/lib/nukadoko/project_program.rb +5 -4
  87. data/lib/nukadoko/repeated_prefix.rb +310 -0
  88. data/lib/nukadoko/report_run.rb +3 -3
  89. data/lib/nukadoko/run.rb +1156 -159
  90. data/lib/nukadoko/run_record.rb +70 -46
  91. data/lib/nukadoko/scaffold.rb +24 -6
  92. data/lib/nukadoko/schema.rb +15 -2
  93. data/lib/nukadoko/secrets.rb +55 -5
  94. data/lib/nukadoko/states.rb +478 -0
  95. data/lib/nukadoko/step.rb +71 -2
  96. data/lib/nukadoko/step_fixtures.rb +52 -3
  97. data/lib/nukadoko/summary.rb +803 -30
  98. data/lib/nukadoko/table.rb +4 -2
  99. data/lib/nukadoko/text_fit.rb +20 -7
  100. data/lib/nukadoko/trace.rb +152 -45
  101. data/lib/nukadoko/tree_passes.rb +95 -33
  102. data/lib/nukadoko/underneath.rb +311 -0
  103. data/lib/nukadoko/verdict.rb +18 -1
  104. data/lib/nukadoko/version.rb +1 -1
  105. data/lib/nukadoko/vocabulary.rb +166 -23
  106. data/lib/nukadoko/walk.rb +2 -2
  107. data/lib/nukadoko/walk_step.rb +1 -1
  108. data/lib/nukadoko.rb +23 -0
  109. data/llms.txt +42 -35
  110. data/sig/generated/nukadoko/base.rbs +4 -4
  111. data/sig/generated/nukadoko/changed_files.rbs +42 -0
  112. data/sig/generated/nukadoko/check.rbs +147 -10
  113. data/sig/generated/nukadoko/claim_drops.rbs +135 -0
  114. data/sig/generated/nukadoko/claim_line.rbs +11 -0
  115. data/sig/generated/nukadoko/claim_rules.rbs +49 -4
  116. data/sig/generated/nukadoko/claim_sides.rbs +63 -12
  117. data/sig/generated/nukadoko/cli.rbs +80 -7
  118. data/sig/generated/nukadoko/codes.rbs +19 -4
  119. data/sig/generated/nukadoko/command.rbs +68 -1
  120. data/sig/generated/nukadoko/command_help.rbs +18 -0
  121. data/sig/generated/nukadoko/compat.rbs +392 -0
  122. data/sig/generated/nukadoko/criteria.rbs +1 -1
  123. data/sig/generated/nukadoko/definition.rbs +50 -0
  124. data/sig/generated/nukadoko/error_frames.rbs +1 -1
  125. data/sig/generated/nukadoko/events/count.rbs +69 -0
  126. data/sig/generated/nukadoko/events/counted.rbs +70 -0
  127. data/sig/generated/nukadoko/events/format.rbs +163 -0
  128. data/sig/generated/nukadoko/events/lists.rbs +47 -0
  129. data/sig/generated/nukadoko/events/path.rbs +161 -0
  130. data/sig/generated/nukadoko/events/read.rbs +109 -0
  131. data/sig/generated/nukadoko/events/reader.rbs +226 -0
  132. data/sig/generated/nukadoko/events/selection.rbs +100 -0
  133. data/sig/generated/nukadoko/events/tally.rbs +227 -0
  134. data/sig/generated/nukadoko/features.rbs +6 -4
  135. data/sig/generated/nukadoko/fixtures.rbs +67 -11
  136. data/sig/generated/nukadoko/http_recording.rbs +1 -1
  137. data/sig/generated/nukadoko/intent.rbs +132 -0
  138. data/sig/generated/nukadoko/intent_file.rbs +46 -0
  139. data/sig/generated/nukadoko/intent_view.rbs +69 -0
  140. data/sig/generated/nukadoko/judgment_file.rbs +7 -1
  141. data/sig/generated/nukadoko/judgments.rbs +10 -0
  142. data/sig/generated/nukadoko/measure_mcp.rbs +104 -0
  143. data/sig/generated/nukadoko/parts.rbs +2 -2
  144. data/sig/generated/nukadoko/path_view.rbs +105 -0
  145. data/sig/generated/nukadoko/place_rows.rbs +43 -0
  146. data/sig/generated/nukadoko/program.rbs +627 -23
  147. data/sig/generated/nukadoko/program_log.rbs +67 -0
  148. data/sig/generated/nukadoko/program_shape.rbs +147 -0
  149. data/sig/generated/nukadoko/project_fixtures.rbs +16 -3
  150. data/sig/generated/nukadoko/project_program.rbs +2 -1
  151. data/sig/generated/nukadoko/repeated_prefix.rbs +172 -0
  152. data/sig/generated/nukadoko/report_run.rbs +1 -1
  153. data/sig/generated/nukadoko/run.rbs +286 -41
  154. data/sig/generated/nukadoko/run_record.rbs +20 -12
  155. data/sig/generated/nukadoko/scaffold.rbs +3 -0
  156. data/sig/generated/nukadoko/schema.rbs +5 -0
  157. data/sig/generated/nukadoko/secrets.rbs +26 -3
  158. data/sig/generated/nukadoko/states.rbs +214 -0
  159. data/sig/generated/nukadoko/step.rbs +58 -1
  160. data/sig/generated/nukadoko/step_fixtures.rbs +39 -0
  161. data/sig/generated/nukadoko/summary.rbs +256 -2
  162. data/sig/generated/nukadoko/table.rbs +3 -2
  163. data/sig/generated/nukadoko/trace.rbs +108 -33
  164. data/sig/generated/nukadoko/tree_passes.rbs +36 -8
  165. data/sig/generated/nukadoko/underneath.rbs +141 -0
  166. data/sig/generated/nukadoko/verdict.rbs +8 -0
  167. data/sig/generated/nukadoko/vocabulary.rbs +45 -6
  168. data/skills/nukadoko/SKILL.md +18 -18
  169. data/skills/nukadoko/references/checking-steps.md +16 -83
  170. data/skills/nukadoko/references/diagnosing.md +6 -6
  171. data/skills/nukadoko/references/done.md +22 -0
  172. data/skills/nukadoko/references/evidence.md +19 -6
  173. data/skills/nukadoko/references/exploring.md +22 -7
  174. data/skills/nukadoko/references/fixtures.md +12 -32
  175. data/skills/nukadoko/references/judgments.md +18 -0
  176. data/skills/nukadoko/references/maintenance.md +1 -1
  177. data/skills/nukadoko/references/merge-risk.md +1 -1
  178. data/skills/nukadoko/references/parts.md +46 -23
  179. data/skills/nukadoko/references/{perturbed-worlds.md → perturbed-systems.md} +30 -12
  180. data/skills/nukadoko/references/program.md +168 -169
  181. data/skills/nukadoko/references/reviewing.md +20 -20
  182. data/skills/nukadoko/references/ruby/checking-steps.md +106 -0
  183. data/skills/nukadoko/references/ruby/examples/cli.md +212 -0
  184. data/skills/nukadoko/references/ruby/fixtures.md +34 -0
  185. data/skills/nukadoko/references/ruby/program.md +112 -0
  186. data/skills/nukadoko/references/ruby/step-files.md +115 -0
  187. data/skills/nukadoko/references/running.md +34 -34
  188. data/skills/nukadoko/references/scenario-rules.md +7 -6
  189. data/skills/nukadoko/references/states.md +7 -1
  190. data/skills/nukadoko/references/step-files.md +41 -120
  191. data/skills/nukadoko/references/typescript/checking-steps.md +129 -0
  192. data/skills/nukadoko/references/{examples → typescript/examples}/cli.md +1 -1
  193. data/skills/nukadoko/references/{examples → typescript/examples}/http-api.md +6 -6
  194. data/skills/nukadoko/references/{examples → typescript/examples}/workflow.md +1 -1
  195. data/skills/nukadoko/references/typescript/fixtures.md +56 -0
  196. data/skills/nukadoko/references/typescript/program.md +111 -0
  197. data/skills/nukadoko/references/typescript/step-files.md +104 -0
  198. data/skills/nukadoko/references/verdicts.md +10 -10
  199. data/skills/nukadoko/references/writing-steps.md +67 -67
  200. data/skills/nukadoko/references/writing-the-feature.md +1 -1
  201. data/skills/nukadoko-verification/SKILL.md +13 -8
  202. metadata +103 -7
  203. data/skills/nukadoko/references/ruby.md +0 -80
@@ -45,8 +45,8 @@ module Nukadoko
45
45
  # : (Array[Engine::Scenario], Array[Engine::Environment]) -> void
46
46
  def one_execution: (Array[Engine::Scenario], Array[Engine::Environment]) -> void
47
47
 
48
- # A run checks the scenarios it selected, then runs them in each world
49
- # it selected; a target or a world it cannot reach is refused first.
48
+ # A run checks the scenarios it selected, then runs them in each system
49
+ # it selected; a target or a system it cannot reach is refused first.
50
50
  # : (Array[singleton(Step)]) -> Integer
51
51
  def run: (Array[singleton(Step)]) -> Integer
52
52
 
@@ -55,13 +55,13 @@ module Nukadoko
55
55
  def count_flag: (String) -> Integer
56
56
 
57
57
  # One pass of a `--base` tree, in the tree's own directory: the plan
58
- # names the world, the environment, and the rows at their place in this
58
+ # names the system, the environment, and the rows at their place in this
59
59
  # tree, and the result goes to the file it names.
60
60
  # : (Array[singleton(Step)]) -> Integer
61
61
  def tree: (Array[singleton(Step)]) -> Integer
62
62
 
63
63
  # `nuka do <step>`: one step alone, its args from --args and from the
64
- # records --use names, in a world started for it. The step record goes
64
+ # records --use names, in a system started for it. The step record goes
65
65
  # to stdout and to .nukadoko/do/<id>/record.json, where a later
66
66
  # `nuka do --use` reads it. A refusal goes to stderr, since stdout is
67
67
  # the record's.
@@ -77,9 +77,31 @@ module Nukadoko
77
77
  def run_one: (Engine::Check) -> Integer
78
78
 
79
79
  # Each from key of the step, from the newest record --use names whose
80
- # step gives it, and where it came from.
81
- # : (singleton(Step), Array[String]) -> [Hash[untyped, untyped], Hash[untyped, String], Array[Hash[Symbol, untyped]]]
82
- def used_args: (singleton(Step), Array[String]) -> [ Hash[untyped, untyped], Hash[untyped, String], Array[Hash[Symbol, untyped]] ]
80
+ # step gives it, and where it came from; and for each files key, the
81
+ # record of the one --use value whose step its `of` names.
82
+ # : (singleton(Step), Array[String]) -> [Hash[untyped, untyped], Hash[untyped, String], Array[Hash[Symbol, untyped]], ^(String, untyped) -> Hash[Symbol, untyped], ^(String, untyped) -> Hash[Symbol, untyped], Hash[String, Hash[Symbol, untyped]]]
83
+ def used_args: (singleton(Step), Array[String]) -> [ Hash[untyped, untyped], Hash[untyped, String], Array[Hash[Symbol, untyped]], ^(String, untyped) -> Hash[Symbol, untyped], ^(String, untyped) -> Hash[Symbol, untyped], Hash[String, Hash[Symbol, untyped]] ]
84
+
85
+ # A list is the files of one execution, so two --use records for one
86
+ # files key are refused, and a key no --use supplies is unjudged: under
87
+ # nuka do no earlier line ran, and --use is how a producer is named.
88
+ # : (singleton(Step), Array[untyped]) -> ^(String, untyped) -> Hash[Symbol, untyped]
89
+ def used_files: (singleton(Step), Array[untyped]) -> ^(String, untyped) -> Hash[Symbol, untyped]
90
+
91
+ # Each events key reads the record --use named for it, one record per
92
+ # key, since a count is of one execution. A key no --use supplies is
93
+ # unjudged with the reason: under nuka do no earlier line ran, and
94
+ # --use is how a producer is named.
95
+ # : (singleton(Step), Array[untyped]) -> ^(String, untyped) -> Hash[Symbol, untyped]
96
+ def used_events: (singleton(Step), Array[untyped]) -> ^(String, untyped) -> Hash[Symbol, untyped]
97
+
98
+ # Where a finished step record's execution events are: its directory
99
+ # with its slice and late lines, whether the late lines are all there,
100
+ # and the system's copy, whose kinds count as reported. A late file
101
+ # whose count no record names may be cut short, so it counts as
102
+ # truncated: an absence then stays unjudged.
103
+ # : (String, Hash[String, untyped]) -> Hash[Symbol, untyped]
104
+ def recorded_events_producer: (String, Hash[String, untyped]) -> Hash[Symbol, untyped]
83
105
 
84
106
  # The record `nuka do` prints, in the TypeScript engine's shape.
85
107
  # : (Hash[Symbol, untyped], String, singleton(Step), Hash[untyped, untyped], Hash[untyped, String], Array[Hash[Symbol, untyped]], Engine::Environment) -> Hash[Symbol, untyped]
@@ -88,6 +110,39 @@ module Nukadoko
88
110
  # : (Engine::Scenario, Array[Engine::Environment]) -> bool
89
111
  def meets?: (Engine::Scenario, Array[Engine::Environment]) -> bool
90
112
 
113
+ # `nuka check --codes`: every code `nuka check` and `nuka run` can print,
114
+ # as findings with no location, and no project read. It answers what
115
+ # could ever be reported, so it holds while the project's config is
116
+ # broken, which is when a reader often reaches for it.
117
+ # : () -> Integer
118
+ def codes: () -> Integer
119
+
120
+ # What makes a step file's definition unreadable, as check names it.
121
+ DEFINITION_CODES: untyped
122
+
123
+ # `--fail-on` codes, repeated or comma-separated, each once.
124
+ # : () -> Array[String]
125
+ def fail_on: () -> Array[String]
126
+
127
+ # The feature files `nuka check <targets>` reads, relative to the
128
+ # project: a file, or each feature file under a directory. A target
129
+ # with a `:line` is refused, since check analyzes whole files.
130
+ # : (Array[String]) -> Array[String]
131
+ def check_targets: (Array[String]) -> Array[String]
132
+
133
+ # A `--fail-on` gate that could never fire is refused before anything
134
+ # is read: a code the check never reports (unknown, or a run or refusal
135
+ # code), and a note under targets, since a note is a fact about the
136
+ # whole project.
137
+ # : () -> Engine::Refusal?
138
+ def fail_on_refusal: () -> Engine::Refusal?
139
+
140
+ # The report, then one line for each `--fail-on` code it holds, so the
141
+ # exit code never changes silently. The finding keeps its severity: what
142
+ # changed is the project's policy, not the finding.
143
+ # : (Engine::Check, Array[Hash[Symbol, untyped]]) -> Integer
144
+ def checked: (Engine::Check, Array[Hash[Symbol, untyped]]) -> Integer
145
+
91
146
  # The `nuka check` that reports the same errors: the files the targets
92
147
  # name, and each --env.
93
148
  # : () -> String
@@ -146,6 +201,19 @@ module Nukadoko
146
201
  # : () -> Array[Engine::Finding]
147
202
  def env_findings: () -> Array[Engine::Finding]
148
203
 
204
+ # A placeholder a system this invocation starts has no value for fails
205
+ # that system before its program starts, and the program alone says so.
206
+ # The systems a run with this invocation's --env starts, each with how
207
+ # it is reached, whether its program names {events}, whether it
208
+ # declares setup, and what it declares with stepsReach; nil with no
209
+ # program, and none when --env names no environment.
210
+ # : () -> Array[Hash[Symbol, untyped]]?
211
+ def started_systems: () -> Array[Hash[Symbol, untyped]]?
212
+
213
+ # A system no command of this invocation starts is not checked.
214
+ # : () -> Array[Engine::Finding]
215
+ def placeholder_findings: () -> Array[Engine::Finding]
216
+
149
217
  # : (Engine::Refusal) -> Integer
150
218
  def refuse: (Engine::Refusal) -> Integer
151
219
 
@@ -159,6 +227,11 @@ module Nukadoko
159
227
  # : (String?, bool, findings: Array[untyped], ?verdict: String, ?exit_code: Integer, **untyped) -> Integer
160
228
  def finish: (String?, bool, findings: Array[untyped], ?verdict: String, ?exit_code: Integer, **untyped) -> Integer
161
229
 
230
+ # A finding is one line and its fix and do one line each, so a reader
231
+ # that splits on newlines and tabs gets the fields back.
232
+ # : (untyped) -> String
233
+ def one_line: (untyped) -> String
234
+
162
235
  # : (Hash[Symbol, untyped], Array[untyped], String?, ?io: IO) -> void
163
236
  def emit: (Hash[Symbol, untyped], Array[untyped], String?, ?io: IO) -> void
164
237
 
@@ -1,9 +1,11 @@
1
1
  # Generated from lib/nukadoko/codes.rb with RBS::Inline
2
2
 
3
- # Every code a finding or a refusal can carry, with its description and
4
- # the edit that gets past it, as the TypeScript engine's registry holds
5
- # them (`bin/sync-codes` writes codes.json from it), so one code reads the
6
- # same in either engine. Data only.
3
+ # Every code a finding or a refusal can carry, with its description, the
4
+ # edit that gets past it, and the registry it comes from (`check`, `run`,
5
+ # or `refusal`), as the TypeScript engine's registries hold them
6
+ # (`bin/sync-codes` writes codes.json from them), so one code reads the
7
+ # same in either engine and `nuka check --codes` lists the same codes in
8
+ # the same order. Data only.
7
9
  module Nukadoko
8
10
  module Engine
9
11
  module Codes
@@ -11,6 +13,19 @@ module Nukadoko
11
13
 
12
14
  # : (String) -> String?
13
15
  def self.fix: (String) -> String?
16
+
17
+ # A code `nuka check` itself reports. A run code can carry a warning
18
+ # or a note too, so the severity alone cannot tell.
19
+ # : (String) -> bool
20
+ def self.check?: (String) -> bool
21
+
22
+ # : (String) -> String?
23
+ def self.severity: (String) -> String?
24
+
25
+ # Every code as a finding with no location: its severity, the code,
26
+ # its description as the message, and its general fix.
27
+ # : () -> Array[Hash[Symbol, String]]
28
+ def self.listed: () -> Array[Hash[Symbol, String]]
14
29
  end
15
30
  end
16
31
  end
@@ -17,10 +17,74 @@ module Nukadoko
17
17
  # `unbundled: true` runs the command with the environment from before
18
18
  # Bundler set up nuka (no BUNDLE_GEMFILE, no -rbundler/setup in RUBYOPT),
19
19
  # for a command in another Ruby project, which has a Gemfile of its own.
20
+ # A system whose program declares stepsReach: "url" refuses the call
21
+ # before anything starts, with CommandRefused: there, a service URL is
22
+ # the only way the code that runs with the scenarios reaches the program.
20
23
  # : (String, ?Array[String], ?cwd: String, ?env: Hash[String | Symbol, String], ?input: String?, ?stdin: String?, ?timeout: Numeric?, ?redact: Hash[String | Symbol, String], ?files: bool, ?unbundled: bool) -> Hash[Symbol, untyped]
21
24
  def self.run_command: (String, ?Array[String], ?cwd: String, ?env: Hash[String | Symbol, String], ?input: String?, ?stdin: String?, ?timeout: Numeric?, ?redact: Hash[String | Symbol, String], ?files: bool, ?unbundled: bool) -> Hash[Symbol, untyped]
22
25
 
26
+ # Raised instead of starting a process, in a system whose program declares
27
+ # stepsReach: "url". There, a service URL is the only way the code that
28
+ # runs with the scenarios reaches the program, so one set of steps runs
29
+ # against services nukadoko starts and against services that are only
30
+ # URLs. `code` is the finding a run reports for it, so a step that
31
+ # rescues the error can tell it from a program that failed.
32
+ class CommandRefused < StandardError
33
+ # : () -> String
34
+ def code: () -> String
35
+
36
+ attr_reader environment: String
37
+
38
+ attr_reader place: String?
39
+
40
+ # : (String, String, String?) -> void
41
+ def initialize: (String, String, String?) -> void
42
+ end
43
+
44
+ # A step or a fixture read setup_result where nothing made a value for it.
45
+ class SetupResultMissing < StandardError
46
+ end
47
+
23
48
  module Engine
49
+ # The rule a system declares with stepsReach, and where in the pass the
50
+ # code that called runs, which together decide whether
51
+ # Nukadoko.run_command may start a process. The rule is the system's, so
52
+ # it is held for the process that runs its steps; the place is per
53
+ # thread, like the processes a step records.
54
+ #
55
+ # Only the helper that starts a process is refused. A step's browser is
56
+ # how it reaches a URL, and a bare Kernel#system is out of this
57
+ # module's sight: nukadoko never saw it, so it can neither refuse nor
58
+ # record it.
59
+ module Reach
60
+ # : () -> Hash[Symbol, String]?
61
+ def self.rule: () -> Hash[Symbol, String]?
62
+
63
+ # Declares `reach` for `environment` from the start of the system's
64
+ # setup until it stops, and gives back what takes it away again.
65
+ # : (String, String) -> ^() -> void
66
+ def self.declare: (String, String) -> ^() -> void
67
+
68
+ # : () -> String?
69
+ def self.place: () -> String?
70
+
71
+ # Runs the block so that a refusal in it names `place`: `setup`,
72
+ # `step "..."`, `fixture "..."`, or a hook.
73
+ # : [T] (String) { () -> T } -> T
74
+ def self.at: [T] (String) { () -> T } -> T
75
+
76
+ # The error that refuses `helper` here, or nil where it may run: no
77
+ # system, or a system whose stepsReach is "any".
78
+ # : (String) -> CommandRefused?
79
+ def self.refusal: (String) -> CommandRefused?
80
+
81
+ # What a refusal says: the helper, where it was called, the
82
+ # environment that declared the rule, and the request to send
83
+ # instead. The TypeScript engine's words, with its own helper name.
84
+ # : (String, String, String?) -> String
85
+ def self.refusal_text: (String, String, String?) -> String
86
+ end
87
+
24
88
  # The processes the running step started, kept per thread so a step
25
89
  # that calls run_command from a helper is still measured.
26
90
  module Processes
@@ -45,6 +109,9 @@ module Nukadoko
45
109
  # : (Hash[String, String?], Array[String], String, String?, Numeric?, group: bool) -> [String, String, Process::Status, bool?]
46
110
  def self.spawn: (Hash[String, String?], Array[String], String, String?, Numeric?, group: bool) -> [ String, String, Process::Status, bool? ]
47
111
 
112
+ # : (Process::Waiter, bool) -> void
113
+ def self.stop: (Process::Waiter, bool) -> void
114
+
48
115
  # `ended` when no process of the group still runs as the leader closed.
49
116
  # : (Integer) -> String
50
117
  def self.group_state: (Integer) -> String
@@ -80,7 +147,7 @@ module Nukadoko
80
147
  # : (?String) -> void
81
148
  def initialize: (?String) -> void
82
149
 
83
- # A directory under the system's temporary directory, named
150
+ # A directory under the machine's temporary directory, named
84
151
  # `<prefix>-` and six characters, as the TypeScript engine names it.
85
152
  # : (?String) -> String
86
153
  def dir: (?String) -> String
@@ -0,0 +1,18 @@
1
+ # Generated from lib/nukadoko/command_help.rb with RBS::Inline
2
+
3
+ # What `nuka <command> --help` prints: the command's usage, what it is for, and the flags
4
+ # it reads. The flags listed here are the ones the command acts on, so the table of what
5
+ # each engine offers (docs/engines.json) can be checked against this text, and a refusal
6
+ # that says "the command's --help lists its flags" points at something that exists.
7
+ module Nukadoko
8
+ module CommandHelp
9
+ type entry = { usage: String, summary: String, flags: Array[[ String, String ]] }
10
+
11
+ JSON_FLAG: [ String, String ]
12
+
13
+ COMMANDS: Hash[String, entry]
14
+
15
+ # : (String) -> String
16
+ def self.text: (String) -> String
17
+ end
18
+ end
@@ -0,0 +1,392 @@
1
+ # Generated from lib/nukadoko/compat.rb with RBS::Inline
2
+
3
+ # The door a cucumber-ruby suite comes in through: its step definitions and
4
+ # support files load as they are, with `Given`, `When`, `Then`, `Before`,
5
+ # `After`, `World`, and `ParameterType` at the top level, as cucumber-ruby
6
+ # defines them, and each line they bind runs with a measured step record.
7
+ # A compat step has no contract: its arguments are the captures in order,
8
+ # then a table or a docstring, and it is named by its pattern
9
+ # (`compat: <pattern>`). It covers the subset suites use most; anything
10
+ # else fails when the file loads or when the step runs, never by doing
11
+ # something other than what cucumber-ruby did.
12
+ module Nukadoko
13
+ module Compat
14
+ # What the door refuses, named so a migrating suite sees why.
15
+ class Unsupported < StandardError
16
+ end
17
+
18
+ # `pending` in a step: cucumber-ruby's Cucumber::Pending. nukadoko has
19
+ # no pending outcome, so the step fails and says so.
20
+ class Pending < StandardError
21
+ end
22
+
23
+ # A step definition as the glue registered it.
24
+ class Registration < Data
25
+ attr_reader keyword(): untyped
26
+
27
+ attr_reader pattern(): untyped
28
+
29
+ attr_reader block(): untyped
30
+
31
+ attr_reader file(): untyped
32
+
33
+ attr_reader line(): untyped
34
+
35
+ def self.new: (untyped keyword, untyped pattern, untyped block, untyped file, untyped line) -> instance
36
+ | (keyword: untyped, pattern: untyped, block: untyped, file: untyped, line: untyped) -> instance
37
+
38
+ def self.members: () -> [ :keyword, :pattern, :block, :file, :line ]
39
+
40
+ def members: () -> [ :keyword, :pattern, :block, :file, :line ]
41
+ end
42
+
43
+ class Registration
44
+ # The pattern's text, as `nuka steps` and the step's name show it.
45
+ # : () -> String
46
+ def source: () -> String
47
+ end
48
+
49
+ # A Before, After, AfterStep, BeforeAll, or AfterAll hook.
50
+ class Hook < Data
51
+ attr_reader type(): untyped
52
+
53
+ attr_reader tags(): untyped
54
+
55
+ attr_reader name(): untyped
56
+
57
+ attr_reader block(): untyped
58
+
59
+ attr_reader file(): untyped
60
+
61
+ attr_reader line(): untyped
62
+
63
+ def self.new: (untyped type, untyped tags, untyped name, untyped block, untyped file, untyped line) -> instance
64
+ | (type: untyped, tags: untyped, name: untyped, block: untyped, file: untyped, line: untyped) -> instance
65
+
66
+ def self.members: () -> [ :type, :tags, :name, :block, :file, :line ]
67
+
68
+ def members: () -> [ :type, :tags, :name, :block, :file, :line ]
69
+ end
70
+
71
+ HOOK_TYPES: untyped
72
+
73
+ STEP_OPTIONS: untyped
74
+
75
+ PARAMETER_TYPE_KEYS: untyped
76
+
77
+ # : () -> Array[Registration]
78
+ def self.steps: () -> Array[Registration]
79
+
80
+ # : () -> Array[Hook]
81
+ def self.hooks: () -> Array[Hook]
82
+
83
+ # : () -> Array[Module]
84
+ def self.world_modules: () -> Array[Module]
85
+
86
+ # : () -> Proc?
87
+ def self.world_factory: () -> Proc?
88
+
89
+ # : (Proc?) -> Proc?
90
+ def self.world_factory=: (Proc?) -> Proc?
91
+
92
+ # : () -> Array[Hash[Symbol, untyped]]
93
+ def self.parameter_types: () -> Array[Hash[Symbol, untyped]]
94
+
95
+ # Each glue file that raised while it loaded, with the first line of
96
+ # what it raised.
97
+ # : () -> Array[[String, String]]
98
+ def self.load_failures: () -> Array[[ String, String ]]
99
+
100
+ # : () -> void
101
+ def self.reset: () -> void
102
+
103
+ # : (Symbol) -> Array[Hook]
104
+ def self.hooks_of: (Symbol) -> Array[Hook]
105
+
106
+ # A new World for one scenario: the factory's object, or a plain one,
107
+ # with every `World` module in and the door's own methods on it.
108
+ # : () -> untyped
109
+ def self.new_world: () -> untyped
110
+
111
+ # A hook's tag expression in the one shape the door reads: `@tag` or
112
+ # `not @tag`. Anything wider would match differently than cucumber-ruby
113
+ # if read loosely, so it is refused.
114
+ TAG: ::Regexp
115
+
116
+ # : (String) -> bool
117
+ def self.tag_expression?: (String) -> bool
118
+
119
+ # Whether a hook applies to a scenario with `tags`: every one of its
120
+ # expressions holds, as cucumber-ruby ands several of them.
121
+ # : (Hook, Array[String]) -> bool
122
+ def self.applies?: (Hook, Array[String]) -> bool
123
+
124
+ # : (String) -> String
125
+ def self.unsupported_tags: (String) -> String
126
+
127
+ # The methods cucumber-ruby's glue calls at the top level of a file.
128
+ module Dsl
129
+ # : (*String, ?name: String?) { (untyped) -> void } -> void
130
+ def Before: (*String, ?name: String?) { (untyped) -> void } -> void
131
+
132
+ # : (*String, ?name: String?) { (untyped) -> void } -> void
133
+ def After: (*String, ?name: String?) { (untyped) -> void } -> void
134
+
135
+ # : (*String, ?name: String?) { (untyped, untyped) -> void } -> void
136
+ def AfterStep: (*String, ?name: String?) { (untyped, untyped) -> void } -> void
137
+
138
+ # : (?name: String?) { () -> void } -> void
139
+ def BeforeAll: (?name: String?) { () -> void } -> void
140
+
141
+ # : (?name: String?) { () -> void } -> void
142
+ def AfterAll: (?name: String?) { () -> void } -> void
143
+
144
+ # : (*untyped) -> void
145
+ def Around: (*untyped) -> void
146
+
147
+ # : (*untyped) -> void
148
+ def InstallPlugin: (*untyped) -> void
149
+
150
+ # : (*untyped) -> void
151
+ def AfterConfiguration: (*untyped) -> void
152
+
153
+ # `World(Module, ...)` mixes modules into every scenario's World, and
154
+ # `World { MyWorld.new }` makes the World itself, as cucumber-ruby does.
155
+ # : (*Module, **Module) ?{ () -> untyped } -> void
156
+ def World: (*Module, **Module) ?{ () -> untyped } -> void
157
+
158
+ # : (**untyped) -> void
159
+ def ParameterType: (**untyped) -> void
160
+ end
161
+
162
+ # : (Symbol, untyped, untyped, Proc?) -> void
163
+ def self.register_step: (Symbol, untyped, untyped, Proc?) -> void
164
+
165
+ # : (Symbol, Array[String], String?, Proc?) -> void
166
+ def self.register_hook: (Symbol, Array[String], String?, Proc?) -> void
167
+
168
+ # : (Hash[Symbol, untyped]) -> void
169
+ def self.register_parameter_type: (Hash[Symbol, untyped]) -> void
170
+
171
+ # The door's own methods on every World.
172
+ module WorldMethods
173
+ # cucumber-ruby's `pending`: the step stops here, and nukadoko, which
174
+ # has no pending outcome, fails it.
175
+ # : (?String) -> bot
176
+ def pending: (?String) -> bot
177
+
178
+ # : (*untyped) -> bot
179
+ def skip_this_scenario: (*untyped) -> bot
180
+
181
+ # Runs another step by its text, on this World, as cucumber-ruby's
182
+ # `step` does. The step it runs is part of this step's record.
183
+ # : (String, ?untyped) -> untyped
184
+ def step: (String, ?untyped) -> untyped
185
+
186
+ # : (*untyped) -> bot
187
+ def steps: (*untyped) -> bot
188
+
189
+ # What cucumber-ruby's `log` and `attach` keep: each goes into the
190
+ # step record's `attachments`, as a typed step's `evidence` does.
191
+ # : (*untyped) -> void
192
+ def log: (*untyped) -> void
193
+
194
+ # : (untyped, ?String?, ?String?) -> void
195
+ def attach: (untyped, ?String?, ?String?) -> void
196
+
197
+ # The page nukadoko measures: its trace, screenshots, and requests are
198
+ # the step's. Capybara's `page`, when the glue uses Capybara, is its
199
+ # own and is not measured.
200
+ # : () -> untyped
201
+ def open_page: () -> untyped
202
+
203
+ # The `request` fixture: requests to the world, measured.
204
+ # : () -> untyped
205
+ def open_request: () -> untyped
206
+ end
207
+
208
+ # What the running step opens on demand, set by the run around each
209
+ # compat step; nil outside one.
210
+ # : () -> (^(Symbol) -> untyped)?
211
+ def self.opener: () -> (^(Symbol) -> untyped)?
212
+
213
+ # : ((^(Symbol) -> untyped)?) -> (^(Symbol) -> untyped)?
214
+ def self.opener=: ((^(Symbol) -> untyped)?) -> (^(Symbol) -> untyped)?
215
+
216
+ # : () -> (^(Symbol, Array[untyped]) -> void)?
217
+ def self.evidence: () -> (^(Symbol, Array[untyped]) -> void)?
218
+
219
+ # : ((^(Symbol, Array[untyped]) -> void)?) -> (^(Symbol, Array[untyped]) -> void)?
220
+ def self.evidence=: ((^(Symbol, Array[untyped]) -> void)?) -> (^(Symbol, Array[untyped]) -> void)?
221
+
222
+ # : (Symbol) -> untyped
223
+ def self.open: (Symbol) -> untyped
224
+
225
+ # cucumber-ruby's DataTable, for the calls glue makes most. A table is
226
+ # read, never changed, and `diff!` is refused rather than half done.
227
+ class DataTable
228
+ # : (Array[Array[String]]) -> void
229
+ def initialize: (Array[Array[String]]) -> void
230
+
231
+ # : () -> Array[Array[String]]
232
+ attr_reader raw: untyped
233
+
234
+ # : () -> Array[Array[String]]
235
+ def rows: () -> Array[Array[String]]
236
+
237
+ # : () -> Array[Hash[String, String]]
238
+ def hashes: () -> Array[Hash[String, String]]
239
+
240
+ # : () -> Array[Hash[Symbol, String]]
241
+ def symbolic_hashes: () -> Array[Hash[Symbol, String]]
242
+
243
+ # : () -> Hash[String, String]
244
+ def rows_hash: () -> Hash[String, String]
245
+
246
+ # : () -> DataTable
247
+ def transpose: () -> DataTable
248
+
249
+ # : () -> Array[Array[String]]
250
+ def cells_rows: () -> Array[Array[String]]
251
+
252
+ # : () -> Integer
253
+ def size: () -> Integer
254
+
255
+ # : (untyped) -> bool
256
+ def ==: (untyped) -> bool
257
+
258
+ # : () -> String
259
+ def to_s: () -> String
260
+
261
+ # : (*untyped) -> bot
262
+ def diff!: (*untyped) -> bot
263
+
264
+ # : (*untyped) -> bot
265
+ def map_headers!: (*untyped) -> bot
266
+
267
+ # : (*untyped) -> bot
268
+ def map_column!: (*untyped) -> bot
269
+ end
270
+
271
+ # The scenario a Before or After hook is given, as cucumber-ruby gives it.
272
+ class Scenario
273
+ # : (String, Array[String], String?, ?status: Symbol) -> void
274
+ def initialize: (String, Array[String], String?, ?status: Symbol) -> void
275
+
276
+ attr_reader name: untyped
277
+
278
+ attr_reader source_tag_names: untyped
279
+
280
+ attr_reader location: untyped
281
+
282
+ attr_accessor status: untyped
283
+
284
+ # : () -> bool
285
+ def failed?: () -> bool
286
+
287
+ # : () -> bool
288
+ def passed?: () -> bool
289
+ end
290
+
291
+ # A step's result as AfterStep is given it.
292
+ class StepResult < Data
293
+ attr_reader status(): untyped
294
+
295
+ attr_reader exception(): untyped
296
+
297
+ def self.new: (untyped status, untyped exception) -> instance
298
+ | (status: untyped, exception: untyped) -> instance
299
+
300
+ def self.members: () -> [ :status, :exception ]
301
+
302
+ def members: () -> [ :status, :exception ]
303
+ end
304
+
305
+ class StepResult
306
+ # : () -> bool
307
+ def passed?: () -> bool
308
+
309
+ # : () -> bool
310
+ def failed?: () -> bool
311
+ end
312
+
313
+ # Each registration as a member of the step vocabulary: a Step
314
+ # subclass named by its pattern, matched with cucumber-expressions or
315
+ # its Regexp, with no contract to check.
316
+ module Step
317
+ # : () -> Array[untyped]
318
+ def self.compat_steps: () -> Array[untyped]
319
+
320
+ # One Step subclass for a registration.
321
+ # : (Registration) -> singleton(Nukadoko::Step)
322
+ def self.build: (Registration) -> singleton(Nukadoko::Step)
323
+
324
+ # What a compat step answers where a typed step reads its declarations.
325
+ module Methods
326
+ # : () -> Registration
327
+ def registration: () -> Registration
328
+
329
+ # : () -> bool
330
+ def compat?: () -> bool
331
+
332
+ # : () -> String
333
+ def step_name: () -> String
334
+
335
+ # : () -> Integer?
336
+ def line: () -> Integer?
337
+
338
+ # : () -> String
339
+ def name: () -> String
340
+
341
+ # No typed pattern: every check of named captures and args passes
342
+ # a compat step by, and `compat_patterns` is what it lists.
343
+ # : (*untyped) -> Array[String]
344
+ def patterns: (*untyped) -> Array[String]
345
+
346
+ # : () -> Array[String]
347
+ def compat_patterns: () -> Array[String]
348
+
349
+ # : () -> bool
350
+ def mutating?: () -> bool
351
+
352
+ # : () -> Symbol
353
+ def body: () -> Symbol
354
+
355
+ # : () -> Array[Symbol]
356
+ def fixtures: () -> Array[Symbol]
357
+
358
+ # : (?Array[untyped]) -> Array[Symbol]
359
+ def bag: (?Array[untyped]) -> Array[Symbol]
360
+
361
+ # The expression the pattern is read with, against the registry
362
+ # typed patterns read, so a parameter type is one mechanism.
363
+ # : () -> untyped
364
+ def expression: () -> untyped
365
+
366
+ # The arguments a line's text matches, or nil.
367
+ # : (String) -> Array[untyped]?
368
+ def match_line: (String) -> Array[untyped]?
369
+
370
+ # Each capture's value, a parameter type's transformer running on
371
+ # the World, as cucumber-ruby runs it.
372
+ # : (Array[untyped], untyped) -> Array[untyped]
373
+ def values: (Array[untyped], untyped) -> Array[untyped]
374
+ end
375
+ end
376
+
377
+ # Registers the World methods at the top level and loads `files`, in
378
+ # cucumber-ruby's order: env.rb first, then the rest of support/, then
379
+ # every other file. A file that raises is kept as a load failure and
380
+ # the rest still load, so one broken file does not hide the others.
381
+ # : (Array[String]) -> void
382
+ def self.load: (Array[String]) -> void
383
+
384
+ # : (Hash[Symbol, untyped]) -> void
385
+ def self.register_type: (Hash[Symbol, untyped]) -> void
386
+
387
+ # The glue files under `features`, in the order cucumber-ruby loads
388
+ # them; the typed step files under `steps_dir` are among them.
389
+ # : (String, String) -> Array[String]
390
+ def self.files: (String, String) -> Array[String]
391
+ end
392
+ end
@@ -10,7 +10,7 @@
10
10
  # content, so a scenario renamed or tagged `@smoke` still says what it said,
11
11
  # though a hook or a World could read them, so such a criterion keeps its
12
12
  # change and is marked `retagged` or `renamed_from`, and runs in the old
13
- # world as a changed mapping does.
13
+ # system as a changed mapping does.
14
14
  #
15
15
  # Matching follows the TypeScript engine's order: the same identity and
16
16
  # content is unchanged; the same content under another identity, where it