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,175 @@
1
+ # Generated from lib/nukadoko/fixtures.rb with RBS::Inline
2
+
3
+ # Fixtures are built by the engine, not the step, so what they record is
4
+ # measured: every request a step sends goes through Request and lands in the
5
+ # step's http.jsonl as it was sent and answered.
6
+ module Nukadoko
7
+ module Engine
8
+ class Response < Data
9
+ attr_reader status(): Integer
10
+
11
+ attr_reader headers(): Hash[String, Array[String]]
12
+
13
+ attr_reader body(): String
14
+
15
+ def self.new: (Integer status, Hash[String, Array[String]] headers, String body) -> instance
16
+ | (status: Integer, headers: Hash[String, Array[String]], body: String) -> instance
17
+
18
+ def self.members: () -> [ :status, :headers, :body ]
19
+
20
+ def members: () -> [ :status, :headers, :body ]
21
+ end
22
+
23
+ class Response
24
+ # : () -> untyped
25
+ def json: () -> untyped
26
+
27
+ # : () -> bool
28
+ def ok?: () -> bool
29
+ end
30
+
31
+ class Request
32
+ attr_reader log: Array[Hash[Symbol, untyped]]
33
+
34
+ # : (String) -> void
35
+ def initialize: (String) -> void
36
+
37
+ BODY_TEXT: untyped
38
+
39
+ # : (Float) -> Integer
40
+ def self.since: (Float) -> Integer
41
+
42
+ # A body as http.jsonl keeps it: its text, at most 16 KiB, and its
43
+ # size; none when there was none.
44
+ # : (Symbol, String?) -> Hash[Symbol, untyped]
45
+ def self.body: (Symbol, String?) -> Hash[Symbol, untyped]
46
+ end
47
+
48
+ # Opened only for a step whose body names page or context, as in the
49
+ # TypeScript engine. Requests the page sends are recorded by the engine's
50
+ # own listener, and each step gets a trace chunk.
51
+ class Browser
52
+ # `secrets` gives the run's loaded secrets when a screenshot is taken,
53
+ # since an environment's env files are read after the browser is made.
54
+ # : (String?, ?Hash[Symbol, untyped], ?secrets: ^() -> Secrets) -> void
55
+ def initialize: (String?, ?Hash[Symbol, untyped], ?secrets: ^() -> Secrets) -> void
56
+
57
+ # Opaque, so a masked secret leaves no trace of its glyphs.
58
+ MASK_COLOR: ::String
59
+
60
+ # Locators for every element of `page`, in every frame, that shows a
61
+ # loaded secret: as text, or as the value of an input or textarea, which
62
+ # is not text `get_by_text` reads, and a step may have typed the secret
63
+ # there. The text redaction of a record cannot reach pixels, and
64
+ # marking or rewriting the elements would change the page the next step
65
+ # reads. Only the value as written is found, not an encoded spelling;
66
+ # `get_by_text` ignores case, which costs pixels, never a leak.
67
+ # : (untyped) -> Array[untyped]
68
+ def secret_masks: (untyped) -> Array[untyped]
69
+
70
+ # A screenshot of `page` at `path` with what shows a secret covered,
71
+ # true once written. No screenshot rather than one that shows a
72
+ # secret: masks not found by `deadline` (a monotonic time) give none,
73
+ # and the image is written only once it arrived. `bounded` holds the
74
+ # screenshot to the deadline too, as a pause and a judged view do.
75
+ # : (untyped, String, Float, ?caret: String?, ?bounded: bool) -> bool
76
+ def masked_shot: (untyped, String, Float, ?caret: String?, ?bounded: bool) -> bool
77
+
78
+ # : (String, Array[Hash[Symbol, untyped]]) -> [untyped, ^() -> void]
79
+ def page_for: (String, Array[Hash[Symbol, untyped]]) -> [ untyped, ^() -> void ]
80
+
81
+ STAMPED_TYPES: untyped
82
+
83
+ ORDERED_KINDS: untyped
84
+
85
+ # The step that runs now, as a page request names it: set for every
86
+ # step, a page or not, so a request a page sends during a step is
87
+ # that step's.
88
+ attr_writer step: Hash[Symbol, untyped]?
89
+
90
+ # Which requests to the world the page had finished receiving the
91
+ # response of, and which were in flight, around a claim step's
92
+ # reading: an order of the events this process received, never a
93
+ # claim that the page drew from a response. Only a document, a
94
+ # fetch, and an XMLHttpRequest count; an EventSource stays open, so
95
+ # it would be in flight on every reading.
96
+ # : (untyped) -> void
97
+ def watch_requests: (untyped) -> void
98
+
99
+ # Runs one reading of a claim step and keeps when it began and ended.
100
+ # : [T] () { () -> T } -> T
101
+ def reading: [T] () { () -> T } -> T
102
+
103
+ # : () -> nil
104
+ def begin_step: () -> nil
105
+
106
+ # A claim step's `pages`, `page_requests`, and `judged_view`, after
107
+ # the reading its claims were judged on, when a page was open.
108
+ # : (String, String, ?aria_in_claims: bool) -> Hash[Symbol, untyped]
109
+ def judged: (String, String, ?aria_in_claims: bool) -> Hash[Symbol, untyped]
110
+
111
+ # : (Hash[Symbol, untyped], String) -> Hash[Symbol, untyped]
112
+ def request_record: (Hash[Symbol, untyped], String) -> Hash[Symbol, untyped]
113
+
114
+ # What the page showed right after the judged reading: its title, a
115
+ # viewport screenshot, and its ARIA snapshot, each with how long after
116
+ # the reading it was taken. The claims judged what observe returned,
117
+ # not these files.
118
+ # In a trace group of its own, so the step's actions leave these calls out.
119
+ # : (String, Float, bool) -> Hash[Symbol, untyped]
120
+ def view: (String, Float, bool) -> Hash[Symbol, untyped]
121
+
122
+ # A step whose claims judge a tree nukadoko took keeps that tree in its
123
+ # claims, so the view takes no second one.
124
+ # : (String, Float, bool) -> Hash[Symbol, untyped]
125
+ def view_files: (String, Float, bool) -> Hash[Symbol, untyped]
126
+
127
+ # : () -> Float
128
+ def monotonic: () -> Float
129
+
130
+ # A page's documents, fetches, and XMLHttpRequests to the world get
131
+ # the running step's traceparent through the Chrome DevTools
132
+ # Protocol's Fetch domain, on a session of the page's own: a header set
133
+ # on the whole context would reach other origins too, and a route
134
+ # turns the browser's cache off. Images, scripts, and stylesheets are
135
+ # left out, since each paused request costs a round trip. A session
136
+ # that cannot be opened leaves the page's requests unstamped.
137
+ # : (untyped) -> void
138
+ def stamp: (untyped) -> void
139
+
140
+ # How long a pause waits for each capture of the page's view. A page
141
+ # whose main thread is stuck answers none of them, and without a
142
+ # deadline the pause would never reach the person.
143
+ VIEW_TIMEOUT_MS: ::Integer
144
+
145
+ # What `nuka run --step` shows at a pause, taken while the run waits:
146
+ # a viewport screenshot and an ARIA snapshot of the open page, named
147
+ # under `recorded_as` as run.json names them. From now until
148
+ # `release`, the requests the page sends go to the pause's own
149
+ # http.jsonl, never to the step's record. `[]` when no page is open.
150
+ # : (String, String) -> Array[Hash[Symbol, untyped]]
151
+ def hold: (String, String) -> Array[Hash[Symbol, untyped]]
152
+
153
+ # The pause is answered: the page's requests are the next step's again.
154
+ # : () -> void
155
+ def release: () -> void
156
+
157
+ # Each scenario gets a browser context of its own, so cookies and storage
158
+ # never carry from one scenario to the next.
159
+ # The browser the scenario opened a page in, as run.json names it, or
160
+ # nil when it opened none.
161
+ # : () -> Hash[Symbol, untyped]?
162
+ def scenario_browser: () -> Hash[Symbol, untyped]?
163
+
164
+ # Closes the scenario's context, and returns the screenshot of its
165
+ # page as the scenario ended, `final.png` in `dir`, when it opened
166
+ # one. A page a failed step left unusable has none, and that costs
167
+ # the screenshot only.
168
+ # : (?String?) -> Array[Hash[Symbol, untyped]]
169
+ def end_scenario: (?String?) -> Array[Hash[Symbol, untyped]]
170
+
171
+ # : () -> void
172
+ def close: () -> void
173
+ end
174
+ end
175
+ end
@@ -0,0 +1,29 @@
1
+ # Generated from lib/nukadoko/http_recording.rb with RBS::Inline
2
+
3
+ # Requests a step sends through Net::HTTP itself, without the `request`
4
+ # fixture, measured as the TypeScript engine measures a step's own `fetch`:
5
+ # each lands in the step's http.jsonl with `via: "net/http"`, and one to
6
+ # the world's origin carries the step's traceparent. It records only while
7
+ # a step runs, on the thread that runs it, so a fixture's setup, the
8
+ # engine's own readiness check, and the `request` fixture (which records
9
+ # its requests itself) go through Net::HTTP untouched.
10
+ module Nukadoko
11
+ module Engine
12
+ module HttpRecording
13
+ # : [T] (Array[untyped]) { () -> T } -> T
14
+ def self.collect: [T] (Array[untyped]) { () -> T } -> T
15
+
16
+ # Net::HTTP as the engine's own code calls it, recording nothing.
17
+ # : [T] () { () -> T } -> T
18
+ def self.unrecorded: [T] () { () -> T } -> T
19
+
20
+ # Prepended to Net::HTTP. `request` calls itself once more when the
21
+ # connection was not started, so only the outermost call records.
22
+ # @rbs module-self Net::HTTP
23
+ module Patch : Net::HTTP
24
+ # : (Net::HTTPGenericRequest, ?String?) ?{ (Net::HTTPResponse) -> void } -> Net::HTTPResponse
25
+ def request: (Net::HTTPGenericRequest, ?String?) ?{ (Net::HTTPResponse) -> void } -> Net::HTTPResponse
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,64 @@
1
+ # Generated from lib/nukadoko/init.rb with RBS::Inline
2
+
3
+ # `nuka init`: the config file, the steps directory, and the .gitignore
4
+ # entries, in the TypeScript engine's order and words. A config file
5
+ # already there refuses the whole command before anything is written, so a
6
+ # half-done init never looks like a finished one. It ends with a
7
+ # self-check that loads the config and the steps as `nuka steps` does; a
8
+ # failure there is reported and the files stay, so what init wrote can be
9
+ # looked at and fixed.
10
+ #
11
+ # The TypeScript engine also adds a package.json script and tsconfig
12
+ # entries. A Ruby project's one command for people and CI is a rake task,
13
+ # so a Rakefile with no `scenarios` task gets one that runs `nuka run`; a
14
+ # project with no Rakefile gets none, since a Rakefile written only for
15
+ # this would be a second place to look. The Gemfile is read too: one that
16
+ # does not name nukadoko gets a line on stderr.
17
+ module Nukadoko
18
+ module Engine
19
+ class Init
20
+ STEPS: untyped
21
+
22
+ # `.env` files are ignored since a committed one is configuration, not
23
+ # a secret source; `!.env.example` must follow `.env.*` to re-include it.
24
+ IGNORED: untyped
25
+
26
+ # The gem's copy is staged at release; a checkout has only the root's.
27
+ STAGED_LLMS: untyped
28
+
29
+ LLMS: untyped
30
+
31
+ # The gem ships no docs/, so the config file points at the spec online.
32
+ SPEC: ::String
33
+
34
+ TASK: ::String
35
+
36
+ # : (String, out: IO, err: IO) -> void
37
+ def initialize: (String, out: IO, err: IO) -> void
38
+
39
+ # The exit code, or a Refusal when a config file exists.
40
+ # : () -> (Integer | Refusal)
41
+ def call: () -> (Integer | Refusal)
42
+
43
+ private
44
+
45
+ # Appends each entry no line already ignores; true when it wrote.
46
+ # : () -> bool
47
+ def ignore_entries: () -> bool
48
+
49
+ # Appends the `scenarios` task to a Rakefile that has none; true when it wrote.
50
+ # : () -> bool
51
+ def scenarios_task: () -> bool
52
+
53
+ # A root directory entry is also ignored by `/name`, `name`, or `name/**`.
54
+ # : (String, String) -> bool
55
+ def covers?: (String, String) -> bool
56
+
57
+ # : () -> void
58
+ def gemfile_note: () -> void
59
+
60
+ # : () -> Integer
61
+ def self_check: () -> Integer
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,109 @@
1
+ # Generated from lib/nukadoko/js_json.rb with RBS::Inline
2
+
3
+ # JSON text read as JavaScript's JSON.parse reads it, and refused in V8's
4
+ # words. A claim's json view reports why a text is no JSON, and that reason
5
+ # is part of the record both engines write, so the Ruby engine walks the
6
+ # grammar V8 walks and names the same place. Ruby's own parser accepts
7
+ # what JSON.parse refuses (comments, a NaN under some options), so the walk
8
+ # also decides what is valid; Ruby's parser only builds the value after it.
9
+ # Positions count UTF-16 code units, as a JavaScript string does.
10
+ module Nukadoko
11
+ module JsJson
12
+ class Error < JSON::ParserError
13
+ end
14
+
15
+ # Texts V8 names whole, since they are what a JavaScript value turns
16
+ # into when it is passed as text by mistake.
17
+ SPECIAL: untyped
18
+
19
+ CONTEXT: ::Integer
20
+
21
+ WHITESPACE: untyped
22
+
23
+ ESCAPES: untyped
24
+
25
+ HEX: untyped
26
+
27
+ # A Failure carries where the walk stopped and what V8 says there.
28
+ class Failure < Data
29
+ attr_reader pos(): untyped
30
+
31
+ attr_reader message(): untyped
32
+
33
+ def self.new: (untyped pos, untyped message) -> instance
34
+ | (pos: untyped, message: untyped) -> instance
35
+
36
+ def self.members: () -> [ :pos, :message ]
37
+
38
+ def members: () -> [ :pos, :message ]
39
+ end
40
+
41
+ # : (String) -> untyped
42
+ def self.parse: (String) -> untyped
43
+
44
+ # A value as JavaScript's JSON.stringify writes it: a whole float is the
45
+ # integer its one number type holds (2.0 is 2), a float its shortest digits
46
+ # (1e20 is 100000000000000000000), and NaN or Infinity null, so a reason that
47
+ # quotes a value reads as the TypeScript engine's does.
48
+ # : (untyped) -> String
49
+ def self.generate: (untyped) -> String
50
+
51
+ # Walks the text once and gives V8's message for the first place it is
52
+ # no JSON, or nil.
53
+ class Walk
54
+ # : (String) -> void
55
+ def initialize: (String) -> void
56
+
57
+ # : () -> String?
58
+ def failure: () -> String?
59
+
60
+ private
61
+
62
+ class Stop < StandardError
63
+ end
64
+
65
+ # : () -> Integer?
66
+ def peek: () -> Integer?
67
+
68
+ # : () -> void
69
+ def space: () -> void
70
+
71
+ # : (String) -> String
72
+ def located: (String) -> String
73
+
74
+ # : (?String?) -> bot
75
+ def stop: (?String?) -> bot
76
+
77
+ # V8's message for a character no rule expected: the text itself when
78
+ # it is short, else ten units on each side of the character.
79
+ # : () -> String
80
+ def unexpected: () -> String
81
+
82
+ # A run of UTF-16 units as text; half of a pair, which a UTF-8 string
83
+ # cannot hold, is the replacement character.
84
+ # : (Array[Integer]) -> String
85
+ def text_of: (Array[Integer]) -> String
86
+
87
+ # : () -> void
88
+ def value: () -> void
89
+
90
+ # : (String) -> void
91
+ def literal: (String) -> void
92
+
93
+ # : () -> void
94
+ def object: () -> void
95
+
96
+ # : () -> void
97
+ def array: () -> void
98
+
99
+ # : () -> void
100
+ def string: () -> void
101
+
102
+ # : () -> void
103
+ def number: () -> void
104
+
105
+ # : () -> bool
106
+ def digit?: () -> bool
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,194 @@
1
+ # Generated from lib/nukadoko/js_pattern.rb with RBS::Inline
2
+
3
+ # Responsibility: read a `matches` claim's pattern as JavaScript's RegExp
4
+ # reads it, so the Ruby engine judges the claim the way the TypeScript
5
+ # engine does: `new RegExp(pattern)`, no flags, with the web's legacy
6
+ # grammar (a `{` that starts no quantifier is a `{`, `\A` is an `A`). Ruby's
7
+ # own grammar reads the same text otherwise: `^` and `$` there match at
8
+ # every line, `\s` takes no Unicode space, `\A` and `\h` mean something,
9
+ # `[^]` does not build, and an unnamed group stops capturing once a named
10
+ # one is present. So the pattern is parsed here and written again as a
11
+ # Ruby pattern that means what the JavaScript one does.
12
+ #
13
+ # JavaScript matches a text unit by UTF-16 unit, so `.` takes half of an
14
+ # emoji. Each half of a character past U+FFFF, in the pattern and in the
15
+ # text, is therefore written as one character of its own in plane 16's
16
+ # private use area (`units`).
17
+ #
18
+ # Honest limits: case-insensitive matching inside `(?i:...)` folds case as
19
+ # Ruby does, which differs for a few letters (the Kelvin sign, the long
20
+ # s); a lookbehind Ruby cannot run (one of unbounded length, or holding a
21
+ # backreference) is refused with Ruby's reason; a group inside a repeated
22
+ # group keeps its capture from an earlier round, where JavaScript clears it.
23
+ module Nukadoko
24
+ module Engine
25
+ module JsPattern
26
+ # A pattern JavaScript refuses, with V8's message.
27
+ class Invalid < StandardError
28
+ end
29
+
30
+ LINE_ENDS: ::String
31
+
32
+ SPACE: ::String
33
+
34
+ WORD: ::String
35
+
36
+ SETS: untyped
37
+
38
+ CONTROL: untyped
39
+
40
+ # Where a UTF-16 surrogate unit is written as a character of its own.
41
+ UNIT_BASE: ::Integer
42
+
43
+ SURROGATES: untyped
44
+
45
+ # Ruby refuses a repeat count past this; JavaScript takes any.
46
+ REPEAT_LIMIT: ::Integer
47
+
48
+ GROUP_NAME: ::Regexp
49
+
50
+ # `text` with each character past U+FFFF written as its two UTF-16
51
+ # units, each in plane 16's private use area.
52
+ # : (String) -> String
53
+ def self.units: (String) -> String
54
+
55
+ # The character a UTF-16 unit is written as.
56
+ # : (Integer) -> String
57
+ def self.unit: (Integer) -> String
58
+
59
+ # The Ruby pattern that matches what `new RegExp(source)` matches, in
60
+ # a text written through `units`.
61
+ # : (String, ?timeout: Float?) -> Regexp
62
+ def self.compile: (String, ?timeout: Float?) -> Regexp
63
+
64
+ # Reads a pattern in JavaScript's legacy grammar and writes it in
65
+ # Ruby's. Every group is written named, `g<n>` by JavaScript's group
66
+ # number, since Ruby stops counting unnamed groups once a named one is
67
+ # present, and a backreference to a group that has not matched
68
+ # matches nothing, as in JavaScript.
69
+ class Parser
70
+ # : (String) -> void
71
+ def initialize: (String) -> void
72
+
73
+ # : () -> String
74
+ def call: () -> String
75
+
76
+ private
77
+
78
+ # : (String) -> bot
79
+ def fail!: (String) -> bot
80
+
81
+ # : (?Integer) -> String?
82
+ def peek: (?Integer) -> String?
83
+
84
+ # : () -> String?
85
+ def take: () -> String?
86
+
87
+ # : (String) -> bool
88
+ def taken?: (String) -> bool
89
+
90
+ # The index of the `>` that ends a group name started at `from`.
91
+ # : (Integer) -> Integer?
92
+ def find_close: (Integer) -> Integer?
93
+
94
+ # Every capturing group's number and every group name, read before
95
+ # the parse, since a backreference may name a later group.
96
+ # : () -> Integer
97
+ def count_groups: () -> Integer
98
+
99
+ # : (Hash[Symbol, bool]) -> String
100
+ def disjunction: (Hash[Symbol, bool]) -> String
101
+
102
+ # : (Hash[Symbol, bool]) -> String
103
+ def alternative: (Hash[Symbol, bool]) -> String
104
+
105
+ # : (Hash[Symbol, bool]) -> String
106
+ def term: (Hash[Symbol, bool]) -> String
107
+
108
+ # `^`, `$`, `\b`, and `\B`, which no quantifier may follow.
109
+ # : (Hash[Symbol, bool]) -> String?
110
+ def assertion: (Hash[Symbol, bool]) -> String?
111
+
112
+ # An atom as Ruby source, and whether a quantifier may follow it:
113
+ # true, false, or :lookbehind, whose refusal V8 words otherwise.
114
+ # : (Hash[Symbol, bool]) -> [String, (bool | Symbol)]
115
+ def atom: (Hash[Symbol, bool]) -> [ String, bool | Symbol ]
116
+
117
+ # : (Hash[Symbol, bool]) -> [String, (bool | Symbol)]
118
+ def group: (Hash[Symbol, bool]) -> [ String, bool | Symbol ]
119
+
120
+ # `(?ims-ims:...)`: the flags it turns on and off, for its body.
121
+ # : (Hash[Symbol, bool]) -> [String, bool]
122
+ def modified: (Hash[Symbol, bool]) -> [ String, bool ]
123
+
124
+ # : () -> Array[String]
125
+ def read_flags: () -> Array[String]
126
+
127
+ # The body of a group through its `)`.
128
+ # : (Hash[Symbol, bool]) -> String
129
+ def closed: (Hash[Symbol, bool]) -> String
130
+
131
+ # A quantifier at this point, as Ruby source, or nil.
132
+ # : () -> String?
133
+ def quantifier: () -> String?
134
+
135
+ # : () -> bool
136
+ def quantifier_ahead?: () -> bool
137
+
138
+ # `{n}`, `{n,}`, or `{n,m}`, read and written for Ruby, or nil when
139
+ # the brace starts none, which makes it a `{`.
140
+ # : () -> String?
141
+ def braced_quantifier: () -> String?
142
+
143
+ # An escape outside a class, from its backslash.
144
+ # : (Hash[Symbol, bool]) -> String
145
+ def escape: (Hash[Symbol, bool]) -> String
146
+
147
+ # `\0`, a backreference, a legacy octal escape, or `\8` and `\9`.
148
+ # : (String) -> String
149
+ def decimal: (String) -> String
150
+
151
+ # A legacy octal escape from its first digit: at most three digits,
152
+ # and at most 0o377.
153
+ # : (String) -> Integer
154
+ def octal: (String) -> Integer
155
+
156
+ # `\xHH` or `\uHHHH` as the unit it names, or nil (and nothing
157
+ # read) when the digits are not there.
158
+ # : (Integer) -> String?
159
+ def hex: (Integer) -> String?
160
+
161
+ # : (Hash[Symbol, bool]) -> String
162
+ def named_reference: (Hash[Symbol, bool]) -> String
163
+
164
+ # The first of `numbers` that matched, or nothing when none did. A
165
+ # group that opens after the reference has never matched there,
166
+ # since JavaScript clears a repeated group's captures each round, so
167
+ # it is left out (Ruby refuses a name it has not seen yet).
168
+ # : (Array[Integer]) -> String
169
+ def backreference: (Array[Integer]) -> String
170
+
171
+ # : () -> String
172
+ def character_class: () -> String
173
+
174
+ # One member of a class: a unit's code, or a set as Ruby source.
175
+ # : () -> (Integer | String)
176
+ def class_atom: () -> (Integer | String)
177
+
178
+ # : (Integer | String) -> String
179
+ def class_part: (Integer | String) -> String
180
+
181
+ # A range of units, with the surrogates in it where `units` writes
182
+ # them.
183
+ # : (Integer, Integer) -> String
184
+ def range: (Integer, Integer) -> String
185
+
186
+ # : (Integer) -> String
187
+ def code: (Integer) -> String
188
+
189
+ # : (String) -> String
190
+ def literal: (String) -> String
191
+ end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,64 @@
1
+ # Generated from lib/nukadoko/judge.rb with RBS::Inline
2
+
3
+ # `nuka judge <file>:<line>`, the one way a judgment gets into a judgment
4
+ # file (docs/spec.md "Judgments"). Without a verdict flag it shows what the
5
+ # criterion asks a judge: each value its Then read, the quality the
6
+ # sentence names, and where the record keeps the value. With `--meets` or
7
+ # `--misses`, `--by`, and `--because` it records one judgment of each.
8
+ #
9
+ # It checks what a machine can, and only that: the run judged this
10
+ # criterion, its required head cells passed, each value is in a channel
11
+ # nukadoko recorded, and the value the step record holds has the digest
12
+ # run.json recorded, so a judgment can only cite a value a run wrote down.
13
+ # It never checks the judgment, nor who made it: `--by` is a name, and the
14
+ # commit that adds the file, with its review, is the record of who judged.
15
+ # It shows and records; it never runs.
16
+ module Nukadoko
17
+ class CLI
18
+ class Judge
19
+ RUNS: untyped
20
+
21
+ # : (String, Array[String], Hash[String, Array[String]], json: bool, out: IO) -> void
22
+ def initialize: (String, Array[String], Hash[String, Array[String]], json: bool, out: IO) -> void
23
+
24
+ # : () -> Integer
25
+ def call: () -> Integer
26
+
27
+ private
28
+
29
+ # : (String) -> Hash[Symbol, untyped]?
30
+ def parse_target: (String) -> Hash[Symbol, untyped]?
31
+
32
+ # The run a name names (its id or its directory), or the newest run
33
+ # that ended.
34
+ # : (String?) -> Hash[Symbol, untyped]?
35
+ def run_named: (String?) -> Hash[Symbol, untyped]?
36
+
37
+ # : (Hash[Symbol, untyped]?, String, Hash[Symbol, untyped], Array[untyped]) -> String?
38
+ def unjudgeable: (Hash[Symbol, untyped]?, String, Hash[Symbol, untyped], Array[untyped]) -> String?
39
+
40
+ # Why the value a step record holds for a read is not the one run.json
41
+ # recorded, or nil when the two agree.
42
+ # : (Hash[Symbol, untyped], untyped) -> String?
43
+ def record_disagrees: (Hash[Symbol, untyped], untyped) -> String?
44
+
45
+ # : (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Array[String]
46
+ def seen_of: (Hash[Symbol, untyped], Hash[Symbol, untyped]) -> Array[String]
47
+
48
+ # : (untyped) -> Array[String]
49
+ def value_block: (untyped) -> Array[String]
50
+
51
+ # : (String, Hash[Symbol, untyped], Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped]) -> Integer
52
+ def show: (String, Hash[Symbol, untyped], Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped]) -> Integer
53
+
54
+ # : (String, Hash[Symbol, untyped], Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], String, String) -> Integer
55
+ def record: (String, Hash[Symbol, untyped], Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], String, String) -> Integer
56
+
57
+ # : (Hash[Symbol, untyped]) -> Integer
58
+ def emit: (Hash[Symbol, untyped]) -> Integer
59
+
60
+ # : (String, ?fix: String?, ?run: String?) -> Integer
61
+ def refused: (String, ?fix: String?, ?run: String?) -> Integer
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,39 @@
1
+ # Generated from lib/nukadoko/judgment_file.rb with RBS::Inline
2
+
3
+ # Where the judgments of a feature file live, reading and writing them,
4
+ # and, under `--base`, which of them changed since the ref (docs/spec.md
5
+ # "Judgments"). What an entry means is lib/nukadoko/judgments.rb's.
6
+ #
7
+ # The files sit in `judgments/` at the project root, one per feature file
8
+ # at the same relative path with `.json` added, outside the features
9
+ # directory on purpose: there every file is mapping, so a judgment added
10
+ # would make `--base` run each unchanged criterion again in the old world,
11
+ # when a judgment changes no step. Nor do they live in the run directory,
12
+ # which retention removes and nobody reviews: a judgment is committed, and
13
+ # the commit and its review are the record of who judged.
14
+ module Nukadoko
15
+ module Engine
16
+ module JudgmentFile
17
+ DIR: ::String
18
+
19
+ # : (String) -> String
20
+ def self?.of: (String) -> String
21
+
22
+ # What a feature's judgment file holds: its entries, none when there
23
+ # is no file, or why it could not be read.
24
+ # : (String, String) -> Hash[Symbol, untyped]
25
+ def self?.read: (String, String) -> Hash[Symbol, untyped]
26
+
27
+ # Writes a feature's judgment file whole, and returns its path
28
+ # relative to the project root.
29
+ # : (String, String, Array[Hash[Symbol, untyped]]) -> String
30
+ def self?.write: (String, String, Array[Hash[Symbol, untyped]]) -> String
31
+
32
+ # Each judgment file the working tree and `commit` hold with other
33
+ # text, or one holds and the other does not, relative to the project
34
+ # root and sorted. nil when git does not answer.
35
+ # : (String, String) -> Array[String]?
36
+ def self?.changed: (String, String) -> Array[String]?
37
+ end
38
+ end
39
+ end