nukadoko 0.1.0 → 0.3.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 (159) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +417 -0
  3. data/README.ja.md +62 -7
  4. data/README.md +19 -5
  5. data/exe/nuka +8 -0
  6. data/lib/nukadoko/aria_snapshot.rb +1008 -0
  7. data/lib/nukadoko/aria_tree.rb +150 -0
  8. data/lib/nukadoko/base.rb +294 -0
  9. data/lib/nukadoko/check.rb +669 -22
  10. data/lib/nukadoko/claim_check.rb +177 -0
  11. data/lib/nukadoko/claim_check_run.rb +293 -0
  12. data/lib/nukadoko/claim_line.rb +381 -0
  13. data/lib/nukadoko/claim_rules.rb +519 -0
  14. data/lib/nukadoko/claim_sides.rb +469 -0
  15. data/lib/nukadoko/claims.rb +576 -37
  16. data/lib/nukadoko/cli.rb +814 -22
  17. data/lib/nukadoko/codes.json +947 -0
  18. data/lib/nukadoko/codes.rb +19 -0
  19. data/lib/nukadoko/command.rb +214 -12
  20. data/lib/nukadoko/criteria.rb +172 -0
  21. data/lib/nukadoko/definition.rb +33 -41
  22. data/lib/nukadoko/env_check.rb +88 -0
  23. data/lib/nukadoko/features.rb +80 -10
  24. data/lib/nukadoko/fixtures.rb +329 -11
  25. data/lib/nukadoko/http_recording.rb +68 -0
  26. data/lib/nukadoko/init.rb +129 -0
  27. data/lib/nukadoko/js_json.rb +274 -0
  28. data/lib/nukadoko/js_pattern.rb +531 -0
  29. data/lib/nukadoko/judge.rb +221 -0
  30. data/lib/nukadoko/judgment_file.rb +78 -0
  31. data/lib/nukadoko/judgments.rb +256 -0
  32. data/lib/nukadoko/literal.rb +129 -0
  33. data/lib/nukadoko/measured.rb +105 -0
  34. data/lib/nukadoko/order.rb +84 -0
  35. data/lib/nukadoko/parts.rb +43 -22
  36. data/lib/nukadoko/pattern.rb +73 -3
  37. data/lib/nukadoko/poll.rb +21 -8
  38. data/lib/nukadoko/program.rb +105 -17
  39. data/lib/nukadoko/project_files.rb +17 -0
  40. data/lib/nukadoko/project_fixtures.rb +17 -2
  41. data/lib/nukadoko/project_program.rb +119 -0
  42. data/lib/nukadoko/report_allure.rb +751 -0
  43. data/lib/nukadoko/report_messages.rb +167 -0
  44. data/lib/nukadoko/report_run.rb +169 -0
  45. data/lib/nukadoko/run.rb +898 -91
  46. data/lib/nukadoko/run_record.rb +535 -0
  47. data/lib/nukadoko/scaffold.rb +1015 -0
  48. data/lib/nukadoko/schema.rb +120 -21
  49. data/lib/nukadoko/secrets.rb +375 -0
  50. data/lib/nukadoko/selection.rb +163 -0
  51. data/lib/nukadoko/signature.rb +4 -1
  52. data/lib/nukadoko/skill.rb +36 -0
  53. data/lib/nukadoko/spaces.rb +28 -0
  54. data/lib/nukadoko/step.rb +68 -21
  55. data/lib/nukadoko/summary.rb +662 -0
  56. data/lib/nukadoko/table.rb +34 -2
  57. data/lib/nukadoko/text_fit.rb +179 -0
  58. data/lib/nukadoko/trace.rb +244 -0
  59. data/lib/nukadoko/trace_actions.rb +116 -0
  60. data/lib/nukadoko/tree_passes.rb +122 -0
  61. data/lib/nukadoko/verdict.rb +128 -0
  62. data/lib/nukadoko/version.rb +2 -1
  63. data/lib/nukadoko/vocabulary.rb +6 -0
  64. data/lib/nukadoko/walk.rb +305 -0
  65. data/lib/nukadoko/walk_files.rb +473 -0
  66. data/lib/nukadoko/walk_step.rb +149 -0
  67. data/lib/nukadoko.rb +60 -2
  68. data/llms.txt +297 -0
  69. data/sig/generated/nukadoko/aria_snapshot.rbs +331 -0
  70. data/sig/generated/nukadoko/aria_tree.rbs +142 -0
  71. data/sig/generated/nukadoko/base.rbs +142 -0
  72. data/sig/generated/nukadoko/check.rbs +255 -0
  73. data/sig/generated/nukadoko/claim_check.rbs +118 -0
  74. data/sig/generated/nukadoko/claim_check_run.rbs +88 -0
  75. data/sig/generated/nukadoko/claim_line.rbs +158 -0
  76. data/sig/generated/nukadoko/claim_rules.rbs +172 -0
  77. data/sig/generated/nukadoko/claim_sides.rbs +207 -0
  78. data/sig/generated/nukadoko/claims.rbs +208 -0
  79. data/sig/generated/nukadoko/cli.rbs +182 -0
  80. data/sig/generated/nukadoko/codes.rbs +16 -0
  81. data/sig/generated/nukadoko/command.rbs +109 -0
  82. data/sig/generated/nukadoko/criteria.rbs +83 -0
  83. data/sig/generated/nukadoko/definition.rbs +30 -0
  84. data/sig/generated/nukadoko/env_check.rbs +34 -0
  85. data/sig/generated/nukadoko/features.rbs +101 -0
  86. data/sig/generated/nukadoko/fixtures.rbs +175 -0
  87. data/sig/generated/nukadoko/http_recording.rbs +29 -0
  88. data/sig/generated/nukadoko/init.rbs +64 -0
  89. data/sig/generated/nukadoko/js_json.rbs +109 -0
  90. data/sig/generated/nukadoko/js_pattern.rbs +194 -0
  91. data/sig/generated/nukadoko/judge.rbs +64 -0
  92. data/sig/generated/nukadoko/judgment_file.rbs +39 -0
  93. data/sig/generated/nukadoko/judgments.rbs +120 -0
  94. data/sig/generated/nukadoko/literal.rbs +71 -0
  95. data/sig/generated/nukadoko/measured.rbs +42 -0
  96. data/sig/generated/nukadoko/order.rbs +54 -0
  97. data/sig/generated/nukadoko/parts.rbs +35 -0
  98. data/sig/generated/nukadoko/pattern.rbs +62 -0
  99. data/sig/generated/nukadoko/poll.rbs +41 -0
  100. data/sig/generated/nukadoko/program.rbs +101 -0
  101. data/sig/generated/nukadoko/project_files.rbs +19 -0
  102. data/sig/generated/nukadoko/project_fixtures.rbs +57 -0
  103. data/sig/generated/nukadoko/project_program.rbs +55 -0
  104. data/sig/generated/nukadoko/report_allure.rbs +268 -0
  105. data/sig/generated/nukadoko/report_messages.rbs +68 -0
  106. data/sig/generated/nukadoko/report_run.rbs +102 -0
  107. data/sig/generated/nukadoko/run.rbs +264 -0
  108. data/sig/generated/nukadoko/run_record.rbs +175 -0
  109. data/sig/generated/nukadoko/scaffold.rbs +328 -0
  110. data/sig/generated/nukadoko/schema.rbs +155 -0
  111. data/sig/generated/nukadoko/secrets.rbs +172 -0
  112. data/sig/generated/nukadoko/selection.rbs +73 -0
  113. data/sig/generated/nukadoko/signature.rbs +17 -0
  114. data/sig/generated/nukadoko/skill.rbs +20 -0
  115. data/sig/generated/nukadoko/spaces.rbs +31 -0
  116. data/sig/generated/nukadoko/step.rbs +115 -0
  117. data/sig/generated/nukadoko/summary.rbs +204 -0
  118. data/sig/generated/nukadoko/table.rbs +43 -0
  119. data/sig/generated/nukadoko/text_fit.rbs +70 -0
  120. data/sig/generated/nukadoko/trace.rbs +127 -0
  121. data/sig/generated/nukadoko/trace_actions.rbs +40 -0
  122. data/sig/generated/nukadoko/tree_passes.rbs +48 -0
  123. data/sig/generated/nukadoko/verdict.rbs +56 -0
  124. data/sig/generated/nukadoko/version.rbs +5 -0
  125. data/sig/generated/nukadoko/vocabulary.rbs +25 -0
  126. data/sig/generated/nukadoko/walk.rbs +139 -0
  127. data/sig/generated/nukadoko/walk_files.rbs +189 -0
  128. data/sig/generated/nukadoko/walk_step.rbs +50 -0
  129. data/sig/generated/nukadoko.rbs +26 -0
  130. data/sig/nukadoko.rbs +5 -48
  131. data/skills/nukadoko/SKILL.md +120 -0
  132. data/skills/nukadoko/references/checking-steps.md +200 -0
  133. data/skills/nukadoko/references/diagnosing.md +200 -0
  134. data/skills/nukadoko/references/done.md +99 -0
  135. data/skills/nukadoko/references/evidence.md +124 -0
  136. data/skills/nukadoko/references/examples/cli.md +230 -0
  137. data/skills/nukadoko/references/examples/http-api.md +342 -0
  138. data/skills/nukadoko/references/examples/workflow.md +173 -0
  139. data/skills/nukadoko/references/exploring.md +184 -0
  140. data/skills/nukadoko/references/fixtures.md +198 -0
  141. data/skills/nukadoko/references/from-prose.md +51 -0
  142. data/skills/nukadoko/references/judgments.md +95 -0
  143. data/skills/nukadoko/references/maintenance.md +97 -0
  144. data/skills/nukadoko/references/merge-risk.md +74 -0
  145. data/skills/nukadoko/references/parts.md +152 -0
  146. data/skills/nukadoko/references/perturbed-worlds.md +109 -0
  147. data/skills/nukadoko/references/program.md +200 -0
  148. data/skills/nukadoko/references/reviewing.md +200 -0
  149. data/skills/nukadoko/references/running.md +200 -0
  150. data/skills/nukadoko/references/scenario-rules.md +188 -0
  151. data/skills/nukadoko/references/states.md +66 -0
  152. data/skills/nukadoko/references/step-files.md +200 -0
  153. data/skills/nukadoko/references/verdicts.md +200 -0
  154. data/skills/nukadoko/references/writing-steps.md +200 -0
  155. data/skills/nukadoko/references/writing-the-feature.md +165 -0
  156. data/skills/nukadoko/scripts/claude-code-verdict-hook.mjs +99 -0
  157. data/skills/nukadoko/scripts/merge-risk.jq +56 -0
  158. data/skills/nukadoko-verification/SKILL.md +263 -0
  159. metadata +133 -1
@@ -0,0 +1,328 @@
1
+ # Generated from lib/nukadoko/scaffold.rb with RBS::Inline
2
+
3
+ # `nuka scaffold`: a step file a person fills in, written in the TypeScript
4
+ # engine's terms. `nuka scaffold <name> --pattern <p> [--then]` writes one
5
+ # stub; `nuka scaffold --feature <path>` writes one per line no step
6
+ # matches, read as a pattern by cucumber-expressions' own generator, and
7
+ # names each from the pattern's literal words. A stub's body raises
8
+ # "not implemented: <name>" until someone writes it, so a run of it fails
9
+ # instead of passing.
10
+ #
11
+ # `--command <entry point>` writes a When step that runs the program under
12
+ # Ruby in an empty scratch directory and returns its exitCode, stdout, and
13
+ # stderr; `--request "<METHOD> <path>"` one that sends a request through the
14
+ # `request` fixture and returns its status and body; and `--from
15
+ # <step>.<key>` the chain to an earlier step's returns, read from that
16
+ # step's own declaration so the two cannot drift apart. A Then step with one
17
+ # stated and one chained value gets a whole claim, so a feature about a
18
+ # program runs green with no hand edit. A step's class name comes from its
19
+ # file name (how `load_steps` autoloads it), so a name whose class would not
20
+ # be a new Ruby constant is refused.
21
+ module Nukadoko
22
+ module Engine
23
+ class Scaffold
24
+ VALID_NAME: ::Regexp
25
+
26
+ NAME_LIMIT: ::Integer
27
+
28
+ NAMED: ::Regexp
29
+
30
+ DESCRIPTION_TODO: ::String
31
+
32
+ CAPTURED: untyped
33
+
34
+ ATTACHMENT: untyped
35
+
36
+ LITERAL_WORDS: untyped
37
+
38
+ NUMBER_WORDS: untyped
39
+
40
+ TIMES_WORDS: untyped
41
+
42
+ STATES_NO_VALUE: ::String
43
+
44
+ LITERAL_FIX: ::String
45
+
46
+ REDO_HEADER: ::String
47
+
48
+ class Capture < Data
49
+ attr_reader key(): String
50
+
51
+ attr_reader type(): String
52
+
53
+ def self.new: (String key, String type) -> instance
54
+ | (key: String, type: String) -> instance
55
+
56
+ def self.members: () -> [ :key, :type ]
57
+
58
+ def members: () -> [ :key, :type ]
59
+ end
60
+
61
+ # : (String, ?String, **untyped) -> Refusal
62
+ def self.refusal: (String, ?String, **untyped) -> Refusal
63
+
64
+ # The captures of `pattern`, or the reason no step could hold it.
65
+ # : (String) -> (Array[Capture] | Refusal)
66
+ def self.read_pattern: (String) -> (Array[Capture] | Refusal)
67
+
68
+ # The class `load_steps` autoloads from the step's file.
69
+ # : (String) -> String
70
+ def self.class_name: (String) -> String
71
+
72
+ # : (String) -> String?
73
+ def self.class_refusal: (String) -> String?
74
+
75
+ # : (String) -> String
76
+ def self.file_of: (String) -> String
77
+
78
+ ENTRY_POINT_PLACEHOLDER: ::String
79
+
80
+ SENT_METHODS: untyped
81
+
82
+ # Neither a capture nor a docstring can end with the newline a program
83
+ # prints last, so a claim on one of these compares its text view.
84
+ OUTPUT_STREAMS: untyped
85
+
86
+ # One args key the template writes: `kind` is the class of the value
87
+ # it holds ("string", "number", or "other") and `json` its JSON type
88
+ # ("string", "number", "array", or nil when that is not known).
89
+ class Field < Data
90
+ attr_reader key(): String
91
+
92
+ attr_reader kind(): String
93
+
94
+ attr_reader json(): String?
95
+
96
+ def self.new: (String key, String kind, String? json) -> instance
97
+ | (key: String, kind: String, json: String?) -> instance
98
+
99
+ def self.members: () -> [ :key, :kind, :json ]
100
+
101
+ def members: () -> [ :key, :kind, :json ]
102
+ end
103
+
104
+ # One args key `from` fills, with every step that can give it, by
105
+ # class name, and the type the first of them declares.
106
+ class Chained < Data
107
+ attr_reader key(): String
108
+
109
+ attr_reader producers(): Array[String]
110
+
111
+ attr_reader type(): untyped
112
+
113
+ def self.new: (String key, Array[String] producers, untyped type) -> instance
114
+ | (key: String, producers: Array[String], type: untyped) -> instance
115
+
116
+ def self.members: () -> [ :key, :producers, :type ]
117
+
118
+ def members: () -> [ :key, :producers, :type ]
119
+ end
120
+
121
+ # : (String) -> String
122
+ def self.ruby: (String) -> String
123
+
124
+ # : (Capture) -> String
125
+ def self.field_line: (Capture) -> String
126
+
127
+ # : (Capture) -> Field
128
+ def self.capture_field: (Capture) -> Field
129
+
130
+ # : (String) -> Field
131
+ def self.attachment_field: (String) -> Field
132
+
133
+ # Only a bare string or number counts as one: a nullable one may hold
134
+ # no value of that type at all.
135
+ # : (Chained) -> Field
136
+ def self.chained_field: (Chained) -> Field
137
+
138
+ # `<METHOD> <path>` as [method, segments], each segment a String sent
139
+ # as it is or a Symbol naming an args key; nil when it is neither.
140
+ # : (String) -> [String, Array[String | Symbol]]?
141
+ def self.read_request: (String) -> [ String, Array[String | Symbol] ]?
142
+
143
+ # : ([String, Array[String | Symbol]]) -> String
144
+ def self.request_text: ([ String, Array[String | Symbol] ]) -> String
145
+
146
+ # The path as a Ruby string literal, each key's value put in its place.
147
+ # : (Array[String | Symbol]) -> String
148
+ def self.path_literal: (Array[String | Symbol]) -> String
149
+
150
+ # : (name: String, pattern: String?, captures: Array[Capture], then_step: bool, attachment: String?, description: String?, ?variant: String?, ?entry: String?, ?cwd: String?, ?argv: String?, ?request: [String, Array[String | Symbol]]?, ?body: String?, ?chained: Array[Chained]) -> String
151
+ def self.template: (name: String, pattern: String?, captures: Array[Capture], then_step: bool, attachment: String?, description: String?, ?variant: String?, ?entry: String?, ?cwd: String?, ?argv: String?, ?request: [ String, Array[String | Symbol] ]?, ?body: String?, ?chained: Array[Chained]) -> String
152
+
153
+ # Stands for the 1-based number of the line that holds it, filled in
154
+ # once the whole file is assembled.
155
+ LINE_MARKER: ::String
156
+
157
+ # : (String, String?, String?, String?, [String, Array[String | Symbol]]?) -> String
158
+ def self.default_description: (String, String?, String?, String?, [ String, Array[String | Symbol] ]?) -> String
159
+
160
+ # : (String, Array[String]) -> Array[String]
161
+ def self.when_lines: (String, Array[String]) -> Array[String]
162
+
163
+ # The guard a step raises while a value has nowhere to go yet. The
164
+ # values are in its message, so the first failed run shows what was
165
+ # bound.
166
+ # : (String, Array[Field], String) -> Array[String]
167
+ def self.unplaced_guard: (String, Array[Field], String) -> Array[String]
168
+
169
+ # : (String, String?, String?, String?, Array[Field], Array[Field]) -> Array[String]
170
+ def self.command_lines: (String, String?, String?, String?, Array[Field], Array[Field]) -> Array[String]
171
+
172
+ # A text the request sends as it is; anything else as JSON.
173
+ # : (String, [String, Array[String | Symbol]], String?, Array[Field]) -> Array[String]
174
+ def self.request_lines: (String, [ String, Array[String | Symbol] ], String?, Array[Field]) -> Array[String]
175
+
176
+ # A Then step's claims. One stated value and one chained value make a
177
+ # whole claim: the chained value is the actual, the stated one the
178
+ # expected. A line that states its value with a word compares the one
179
+ # chained value with that word's literal. Otherwise the first stated
180
+ # value is the expected one, and observe raises until someone writes
181
+ # the reading, so the step records as unobserved instead of passing.
182
+ # : (String, String?, Array[String], Array[Field], Array[Field]) -> Array[String]
183
+ def self.then_lines: (String, String?, Array[String], Array[Field], Array[Field]) -> Array[String]
184
+
185
+ # : (untyped) -> String
186
+ def self.ruby_literal: (untyped) -> String
187
+
188
+ # The first word's literal of `json`, and the compare it takes (not-equal
189
+ # right after a fixed `not`); nil when no word fixes a value of it.
190
+ # : (String?, String?) -> [String, untyped, String]?
191
+ def self.word_literal: (String?, String?) -> [ String, untyped, String ]?
192
+
193
+ # : (untyped) -> String?
194
+ def self.json_of: (untyped) -> String?
195
+
196
+ # Whether `source` is a stub this command writes for `name`: some
197
+ # reading of its own lines draws it byte for byte. `type_of` gives the
198
+ # type a step, by class name, returns under a key, or nil.
199
+ # : (String, String, ?^(String, String) -> untyped) -> bool
200
+ def self.unedited?: (String, String, ?^(String, String) -> untyped) -> bool
201
+
202
+ # The string a ` <call> "..."` line passes, nil when there is no such
203
+ # line, false when the line holds something else.
204
+ # : (String, String, ?parenthesized: bool) -> (String | false | nil)
205
+ def self.literal: (String, String, ?parenthesized: bool) -> (String | false | nil)
206
+
207
+ # The request a `--request` stub sends, as [request, body key], nil
208
+ # when it sends none, false when the line is not one scaffold writes.
209
+ # : (String) -> ([[String, Array[String | Symbol]], String?] | false | nil)
210
+ def self.sent_request: (String) -> ([ [ String, Array[String | Symbol] ], String? ] | false | nil)
211
+
212
+ # The `from` a stub declares, each key's producers by class name and
213
+ # the type the first returns; nil when a producer's type is unknown.
214
+ # : (String, ^(String, String) -> untyped) -> Array[Chained]?
215
+ def self.chained_in: (String, ^(String, String) -> untyped) -> Array[Chained]?
216
+
217
+ # : (String?) -> Array[String]
218
+ def self.words: (String?) -> Array[String]
219
+
220
+ # Each word of the pattern that states a literal, with its values.
221
+ # : (String?) -> Array[[String, Array[untyped]]]
222
+ def self.literal_words: (String?) -> Array[[ String, Array[untyped] ]]
223
+
224
+ # : (String?, Array[Capture], String?) -> bool
225
+ def self.states_value?: (String?, Array[Capture], String?) -> bool
226
+
227
+ # A word's values differ in JSON type (`no` fixes 0, "", or []), so the
228
+ # claim needs exactly one chained value whose type the word fixes.
229
+ # : (String?, Array[Capture], String?, ?Array[Field]) -> String?
230
+ def self.literal_refusal: (String?, Array[Capture], String?, ?Array[Field]) -> String?
231
+
232
+ # : (String) -> String
233
+ def self.with_article: (String) -> String
234
+
235
+ TYPE_FIX: ::String
236
+
237
+ # A claim across two JSON types never holds, so a line that states one
238
+ # value and chains one of another type is refused.
239
+ # : (String?, Array[Capture], Array[Field], Array[Field]) -> String?
240
+ def self.type_refusal: (String?, Array[Capture], Array[Field], Array[Field]) -> String?
241
+
242
+ # : (String, Hash[String, Array[String]], Array[String], Array[singleton(Step)], Array[Scenario]) -> void
243
+ def initialize: (String, Hash[String, Array[String]], Array[String], Array[singleton(Step)], Array[Scenario]) -> void
244
+
245
+ # The paths written, and the lines for stderr, or a Refusal.
246
+ # : () -> ([Array[String], Array[String]] | Refusal)
247
+ def call: () -> ([ Array[String], Array[String] ] | Refusal)
248
+
249
+ # : () -> ([Array[String], Array[String]] | Refusal)
250
+ def single: () -> ([ Array[String], Array[String] ] | Refusal)
251
+
252
+ # : (String) -> String
253
+ def self.command_took_the_name: (String) -> String
254
+
255
+ # The command line after `nuka scaffold`, as typed, for a refusal's do.
256
+ attr_writer argv_words: Array[String]
257
+
258
+ # Whether `--command <value>` came before the name, so a name typed
259
+ # right after the flag was read as its value.
260
+ attr_writer command_before_name: bool
261
+
262
+ private
263
+
264
+ # Each `--from` as [step, key], or the reason one cannot be.
265
+ # : (Array[Capture]) -> (Array[[String, String]] | Refusal)
266
+ def from_links: (Array[Capture]) -> (Array[[ String, String ]] | Refusal)
267
+
268
+ # The type a step, by class name, declares for a returns key.
269
+ # : () -> ^(String, String) -> untyped
270
+ def type_of: () -> ^(String, String) -> untyped
271
+
272
+ # Each `--from` resolved against the project's steps, grouped by key,
273
+ # or the first producer that cannot give its key.
274
+ # : (Array[[String, String]]) -> (Array[Chained] | Refusal)
275
+ def chain: (Array[[ String, String ]]) -> (Array[Chained] | Refusal)
276
+
277
+ # Why `--argv <key>` cannot split that key, or nil when it is a string
278
+ # capture that stays in argv.
279
+ # : (String, bool, String?, Array[Capture]) -> Refusal?
280
+ def argv_refusal: (String, bool, String?, Array[Capture]) -> Refusal?
281
+
282
+ public
283
+
284
+ # : (String) -> ([Array[String], Array[String]] | Refusal)
285
+ def feature: (String) -> ([ Array[String], Array[String] ] | Refusal)
286
+
287
+ # How cucumber-expressions reads a line: with captures when every
288
+ # reading hands the step the same kind of value, otherwise as the line
289
+ # itself, with the readings it could not choose between.
290
+ # : (String) -> Hash[Symbol, untyped]
291
+ def self.infer: (String) -> Hash[Symbol, untyped]
292
+
293
+ # The generator escapes `(`, `{`, and `/` but leaves a backslash bare,
294
+ # which the parser then refuses, so each backslash is doubled first.
295
+ # : (String, untyped) -> Array[untyped]
296
+ def self.generate: (String, untyped) -> Array[untyped]
297
+
298
+ # The line as a pattern that matches it and nothing else.
299
+ # : (String) -> String
300
+ def self.literal_pattern: (String) -> String
301
+
302
+ # : (String) -> String
303
+ def self.name_captures: (String) -> String
304
+
305
+ # : (String) -> String
306
+ def self.name_for: (String) -> String
307
+
308
+ private
309
+
310
+ # : (String) { (String) -> boolish } -> String
311
+ def distinct: (String) { (String) -> boolish } -> String
312
+
313
+ # : (PickleStep) -> String?
314
+ def attachment_of: (PickleStep) -> String?
315
+
316
+ # What every feature line the pattern matches carries, or nil when no
317
+ # line matches or the lines disagree.
318
+ # : (String) -> String?
319
+ def attachment_in_features: (String) -> String?
320
+
321
+ # : (String) -> (Array[String] | Refusal)
322
+ def target_paths: (String) -> (Array[String] | Refusal)
323
+
324
+ # : (String, String) -> void
325
+ def write: (String, String) -> void
326
+ end
327
+ end
328
+ end
@@ -0,0 +1,155 @@
1
+ # Generated from lib/nukadoko/schema.rb with RBS::Inline
2
+
3
+ # One declaration of a step's args or returns gives three things: the check
4
+ # a value must pass at run time, the RBS a Steep user checks the step body
5
+ # against, and the Data class the body receives. A type is a symbol for a
6
+ # scalar, `[:array, type]` for a list, or a nested Schema for an object.
7
+ module Nukadoko
8
+ class Schema
9
+ class Field < Data
10
+ attr_reader name(): Symbol
11
+
12
+ attr_reader type(): untyped
13
+
14
+ attr_reader description(): String?
15
+
16
+ def self.new: (Symbol name, untyped type, String? description) -> instance
17
+ | (name: Symbol, type: untyped, description: String?) -> instance
18
+
19
+ def self.members: () -> [ :name, :type, :description ]
20
+
21
+ def members: () -> [ :name, :type, :description ]
22
+ end
23
+
24
+ # : () ?{ () [self: Schema] -> void } -> Schema
25
+ def self.build: () ?{ () [self: Schema] -> void } -> Schema
26
+
27
+ attr_reader fields: Array[Field]
28
+
29
+ # : (?Array[Field]) -> void
30
+ def initialize: (?Array[Field]) -> void
31
+
32
+ # `null: true` lets the value be nil as well, as zod's `.nullable()` does.
33
+ # : (Symbol, ?String?, ?null: bool) -> void
34
+ def string: (Symbol, ?String?, ?null: bool) -> void
35
+
36
+ # : (Symbol, ?String?, ?null: bool) -> void
37
+ def boolean: (Symbol, ?String?, ?null: bool) -> void
38
+
39
+ # : (Symbol, ?String?, ?null: bool) -> void
40
+ def integer: (Symbol, ?String?, ?null: bool) -> void
41
+
42
+ # : (Symbol, ?String?, ?null: bool) -> void
43
+ def number: (Symbol, ?String?, ?null: bool) -> void
44
+
45
+ # : (Symbol, ?String?) -> void
46
+ def unknown: (Symbol, ?String?) -> void
47
+
48
+ # : (Symbol, Array[String | Symbol], ?String?, ?null: bool) -> void
49
+ def enum: (Symbol, Array[String | Symbol], ?String?, ?null: bool) -> void
50
+
51
+ # : (Symbol, ?String?, ?null: bool) -> void
52
+ def strings: (Symbol, ?String?, ?null: bool) -> void
53
+
54
+ # : (Symbol, ?String?, ?null: bool) -> void
55
+ def table: (Symbol, ?String?, ?null: bool) -> void
56
+
57
+ # : (Symbol, ?String?, ?null: bool) { () [self: Schema] -> void } -> void
58
+ def object: (Symbol, ?String?, ?null: bool) { () [self: Schema] -> void } -> void
59
+
60
+ # Reuses a field another step declared, so two contracts that must agree
61
+ # on one shape are written once: `field :created, AnItemExists.returns[:body]`.
62
+ # : (Symbol, Field, ?String?) -> void
63
+ def field: (Symbol, Field, ?String?) -> void
64
+
65
+ # : (Symbol | String) -> Field?
66
+ def []: (Symbol | String) -> Field?
67
+
68
+ # : (Array[String]) -> Schema
69
+ def without: (Array[String]) -> Schema
70
+
71
+ # : () -> untyped
72
+ def data_class: () -> untyped
73
+
74
+ # : (Hash[String, untyped]) -> untyped
75
+ def load: (Hash[String, untyped]) -> untyped
76
+
77
+ # Every way `value` departs from the schema, as `path: problem` lines in
78
+ # zod's words, so a step fails with the text the TypeScript engine gives.
79
+ # A key the schema does not declare is no problem: as a zod object does,
80
+ # the schema drops it (`strip`), and `dropped` names where. `strict`
81
+ # refuses one at the root instead, as the TypeScript engine's args do.
82
+ # : (untyped, ?String?, ?strict: bool) -> Array[String]
83
+ def problems: (untyped, ?String?, ?strict: bool) -> Array[String]
84
+
85
+ # The value with every key the schema does not declare left out, at any
86
+ # depth, with string keys. Assumes `problems` found none.
87
+ # : (Hash[untyped, untyped]) -> Hash[String, untyped]
88
+ def strip: (Hash[untyped, untyped]) -> Hash[String, untyped]
89
+
90
+ # : (untyped, untyped) -> untyped
91
+ def self.strip_type: (untyped, untyped) -> untyped
92
+
93
+ # The paths of the keys `strip` leaves out, so a record can say what the
94
+ # step returned and the contract did not keep.
95
+ # : (Hash[untyped, untyped], ?String?) -> Array[String]
96
+ def dropped: (Hash[untyped, untyped], ?String?) -> Array[String]
97
+
98
+ # The keys the schema dropped, one entry per place that dropped any:
99
+ # `at` is the place as its keys and indexes, as the TypeScript engine's
100
+ # `returns_dropped` names it.
101
+ # : (untyped, ?Array[String]) -> Array[Hash[Symbol, untyped]]
102
+ def drops: (untyped, ?Array[String]) -> Array[Hash[Symbol, untyped]]
103
+
104
+ # : (untyped, untyped, Array[String]) -> Array[Hash[Symbol, untyped]]
105
+ def self.drops_type: (untyped, untyped, Array[String]) -> Array[Hash[Symbol, untyped]]
106
+
107
+ # : (untyped, untyped, String) -> Array[String]
108
+ def self.dropped_type: (untyped, untyped, String) -> Array[String]
109
+
110
+ # A key the value does not hold, which zod reads as undefined.
111
+ MISSING: untyped
112
+
113
+ SAFE: untyped
114
+
115
+ # What zod calls a value's type in "received ...".
116
+ # : (untyped) -> String
117
+ def self.received: (untyped) -> String
118
+
119
+ # : (String, untyped) -> String
120
+ def self.invalid: (String, untyped) -> String
121
+
122
+ # : (untyped, untyped, String) -> Array[String]
123
+ def self.type_problems: (untyped, untyped, String) -> Array[String]
124
+
125
+ # zod's int: a finite whole number within Number.MAX_SAFE_INTEGER.
126
+ # : (untyped) -> String?
127
+ def self.integer_problem: (untyped) -> String?
128
+
129
+ # The JSON Schema `nuka describe` prints, as zod's own conversion gives it:
130
+ # the root is closed, and an inner object is closed only on the output
131
+ # side (`returns`), where zod drops the keys it does not declare.
132
+ # : (?root: bool, ?output: bool) -> Hash[Symbol, untyped]
133
+ def json_schema: (?root: bool, ?output: bool) -> Hash[Symbol, untyped]
134
+
135
+ # : (untyped, ?bool) -> Hash[Symbol, untyped]
136
+ def self.json_type: (untyped, ?bool) -> Hash[Symbol, untyped]
137
+
138
+ # : () -> Array[String]
139
+ def rbs_fields: () -> Array[String]
140
+
141
+ # : () -> String
142
+ def rbs_record: () -> String
143
+
144
+ # : (untyped) -> String
145
+ def self.rbs_type: (untyped) -> String
146
+
147
+ private
148
+
149
+ # : (Symbol, untyped, String?, ?bool) -> void
150
+ def add: (Symbol, untyped, String?, ?bool) -> void
151
+
152
+ # : (String?, Symbol | String) -> String
153
+ def join: (String?, Symbol | String) -> String
154
+ end
155
+ end
@@ -0,0 +1,172 @@
1
+ # Generated from lib/nukadoko/secrets.rb with RBS::Inline
2
+
3
+ # Env files and the secrets they hold, as docs/spec.md "Environments and
4
+ # secrets" describes and the TypeScript engine reads them: one KEY=VALUE
5
+ # parser for the env fixture and the secret set, so the two agree on what a
6
+ # file holds; git as the classifier of which files are secret sources; and
7
+ # one redaction that writes `{{secret.NAME}}` for a loaded value in every
8
+ # spelling a record can carry it in. Nothing here decides when to redact:
9
+ # the run calls `redact` on each surface it writes.
10
+ module Nukadoko
11
+ module Engine
12
+ module EnvFile
13
+ # A configured env file that is on disk and cannot be read: setup
14
+ # stops, since a key the steps need would otherwise look missing.
15
+ class Unreadable < StandardError
16
+ # : (String, String) -> void
17
+ def initialize: (String, String) -> void
18
+ end
19
+
20
+ QUOTES: untyped
21
+
22
+ # : (String) -> Hash[String, String]
23
+ def self.parse: (String) -> Hash[String, String]
24
+
25
+ # The 1-based numbers of the lines that were not loaded; a blank, a
26
+ # comment, and a line inside a quoted value are not among them.
27
+ # : (String) -> Array[Integer]
28
+ def self.skipped_lines: (String) -> Array[Integer]
29
+
30
+ # The format dotenv's default parser reads, with `=` as the only
31
+ # separator, scanned by hand so the lines it skips can be named.
32
+ # : (String) -> [Hash[String, String], Array[Integer]]
33
+ def self.scan: (String) -> [ Hash[String, String], Array[Integer] ]
34
+
35
+ # : (String?) -> bool
36
+ def self.space?: (String?) -> bool
37
+
38
+ # A quoted value and where the scan resumes, or nil when the quote does
39
+ # not close or text follows it, so the line reads as unquoted.
40
+ # : (String, Integer, Integer) -> [String, Integer, Integer]?
41
+ def self.quoted: (String, Integer, Integer) -> [ String, Integer, Integer ]?
42
+
43
+ # : (String, Integer, Integer) -> [Integer, Integer]
44
+ def self.rest_of_line: (String, Integer, Integer) -> [ Integer, Integer ]
45
+
46
+ # The configured files merged in order, later files winning. A path
47
+ # that is not on disk gives nothing, which `nuka check` warns about;
48
+ # any other failure to read raises. The process environment is never
49
+ # merged in, so the same files give the same record on any machine.
50
+ # : (String, Array[String]) -> Hash[String, String]
51
+ def self.load: (String, Array[String]) -> Hash[String, String]
52
+
53
+ # : (String, String) -> String?
54
+ def self.read: (String, String) -> String?
55
+ end
56
+
57
+ # One run's secret values, and the redaction that writes each as
58
+ # `{{secret.NAME}}`.
59
+ class Secrets
60
+ # A shorter value would match ordinary text (ids, statuses, short
61
+ # words) all over a record and destroy what redaction protects.
62
+ MIN_LENGTH: ::Integer
63
+
64
+ # What encodeURIComponent leaves as itself.
65
+ URI_KEPT: ::Regexp
66
+
67
+ # What URLSearchParams leaves as itself; a space becomes `+`.
68
+ FORM_KEPT: ::Regexp
69
+
70
+ # Which configured files are secret sources: untracked, ignored, or
71
+ # tracked and different from HEAD. When git cannot answer (no git, no
72
+ # repository, no HEAD), every file is one: the classification fails
73
+ # safe and never fails the run.
74
+ # : (String, Array[String]) -> { tracked: Array[String], source: Array[String] }
75
+ def self.classify: (String, Array[String]) -> { tracked: Array[String], source: Array[String] }
76
+
77
+ # Every key of a secret source except `public` ones, and the keys of a
78
+ # tracked file that `redact` names, each at least MIN_LENGTH long.
79
+ # : (String, Array[String], ?public_keys: Array[String], ?redact_keys: Array[String]) -> Secrets
80
+ def self.of: (String, Array[String], ?public_keys: Array[String], ?redact_keys: Array[String]) -> Secrets
81
+
82
+ # : Hash[String, String]
83
+ attr_reader values: untyped
84
+
85
+ # Each name with its value, a name twice when two sets held it with
86
+ # different values (`with`), so neither value goes unredacted.
87
+ # : Array[[String, String]]
88
+ attr_reader pairs: untyped
89
+
90
+ # : (?Hash[String, String] | Array[[String, String]]) -> void
91
+ def initialize: (?Hash[String, String] | Array[[ String, String ]]) -> void
92
+
93
+ # : () -> bool
94
+ def empty?: () -> bool
95
+
96
+ # Both sets: a tree's pass redacts with head's secrets as well as its
97
+ # own, since the tree's config must not decide which of head's values
98
+ # may print.
99
+ # : (Secrets) -> Secrets
100
+ def with: (Secrets) -> Secrets
101
+
102
+ # Every loaded value, each once.
103
+ # : () -> Array[String]
104
+ def shown_values: () -> Array[String]
105
+
106
+ # A copy of `value` with every secret spelling in its strings and
107
+ # keys written as its token. Two keys that redact to one would lose
108
+ # a subtree, so that raises.
109
+ # : (untyped) -> untyped
110
+ def redact: (untyped) -> untyped
111
+
112
+ # One pass over every spelling and every token, longest first, so a
113
+ # token already in the text matches as itself and a second redaction
114
+ # changes nothing.
115
+ # : (String) -> String
116
+ def redact_string: (String) -> String
117
+
118
+ private
119
+
120
+ # Each spelling a record can hold a value in: the value, its
121
+ # percent-encoded forms (as encodeURIComponent writes it, and with `'`
122
+ # as `%27`, as a URL's href does), its form-urlencoded form, and the
123
+ # inside of its JSON string. A raw value claims its spelling first;
124
+ # among equals the alphabetically first name wins.
125
+ # : () -> Hash[String, String]
126
+ def replacements: () -> Hash[String, String]
127
+
128
+ # : (String, Regexp, ?space: String?) -> String
129
+ def encode: (String, Regexp, ?space: String?) -> String
130
+ end
131
+
132
+ # What project code prints while a step runs reaches stderr, with the
133
+ # run's secrets redacted, so `nuka do`'s stdout stays the record alone
134
+ # and a printed token is no plainer than the record it was kept out of.
135
+ # A value split across two writes is not found, and a child process
136
+ # that writes to the file descriptors itself is not seen.
137
+ class RedactedOutput
138
+ # : [T] (Secrets) { () -> T } -> T
139
+ def self.around: [T] (Secrets) { () -> T } -> T
140
+
141
+ # : (untyped, Secrets) -> void
142
+ def initialize: (untyped, Secrets) -> void
143
+
144
+ # : (*untyped) -> Integer
145
+ def write: (*untyped) -> Integer
146
+
147
+ # : (*untyped) -> nil
148
+ def puts: (*untyped) -> nil
149
+
150
+ # : (*untyped) -> nil
151
+ def print: (*untyped) -> nil
152
+
153
+ # : (String, *untyped) -> nil
154
+ def printf: (String, *untyped) -> nil
155
+
156
+ # : (untyped) -> self
157
+ def <<: (untyped) -> self
158
+
159
+ # : () -> self
160
+ def flush: () -> self
161
+
162
+ # : () -> bool
163
+ def sync: () -> bool
164
+
165
+ # : (bool) -> bool
166
+ def sync=: (bool) -> bool
167
+
168
+ # : () -> bool
169
+ def tty?: () -> bool
170
+ end
171
+ end
172
+ end