nukadoko 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +126 -0
- data/README.ja.md +5 -3
- data/README.md +5 -3
- data/lib/nukadoko/aria_snapshot.rb +4 -4
- data/lib/nukadoko/base.rb +49 -29
- data/lib/nukadoko/check.rb +4 -4
- data/lib/nukadoko/claim_check.rb +2 -2
- data/lib/nukadoko/claim_rules.rb +1 -1
- data/lib/nukadoko/claim_sides.rb +469 -0
- data/lib/nukadoko/claims.rb +182 -20
- data/lib/nukadoko/cli.rb +16 -7
- data/lib/nukadoko/codes.json +20 -15
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/env_check.rb +1 -3
- data/lib/nukadoko/fixtures.rb +53 -21
- data/lib/nukadoko/init.rb +0 -1
- data/lib/nukadoko/js_json.rb +274 -0
- data/lib/nukadoko/js_pattern.rb +531 -0
- data/lib/nukadoko/parts.rb +1 -1
- data/lib/nukadoko/pattern.rb +62 -2
- data/lib/nukadoko/poll.rb +5 -3
- data/lib/nukadoko/program.rb +5 -5
- data/lib/nukadoko/project_files.rb +17 -0
- data/lib/nukadoko/project_program.rb +119 -0
- data/lib/nukadoko/run.rb +47 -17
- data/lib/nukadoko/run_record.rb +25 -22
- data/lib/nukadoko/schema.rb +60 -18
- data/lib/nukadoko/secrets.rb +20 -4
- data/lib/nukadoko/spaces.rb +28 -0
- data/lib/nukadoko/step.rb +7 -1
- data/lib/nukadoko/text_fit.rb +1 -1
- data/lib/nukadoko/tree_passes.rb +6 -3
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko.rb +24 -2
- data/llms.txt +12 -11
- data/sig/generated/nukadoko/aria_snapshot.rbs +2 -2
- data/sig/generated/nukadoko/base.rbs +24 -18
- data/sig/generated/nukadoko/check.rbs +1 -1
- data/sig/generated/nukadoko/claim_sides.rbs +207 -0
- data/sig/generated/nukadoko/claims.rbs +46 -3
- data/sig/generated/nukadoko/cli.rbs +1 -1
- data/sig/generated/nukadoko/env_check.rbs +0 -4
- data/sig/generated/nukadoko/fixtures.rbs +25 -2
- data/sig/generated/nukadoko/init.rbs +0 -2
- data/sig/generated/nukadoko/js_json.rbs +109 -0
- data/sig/generated/nukadoko/js_pattern.rbs +194 -0
- data/sig/generated/nukadoko/pattern.rbs +34 -0
- data/sig/generated/nukadoko/poll.rbs +3 -2
- data/sig/generated/nukadoko/program.rbs +1 -1
- data/sig/generated/nukadoko/project_files.rbs +19 -0
- data/sig/generated/nukadoko/project_program.rbs +55 -0
- data/sig/generated/nukadoko/run.rbs +10 -3
- data/sig/generated/nukadoko/run_record.rbs +5 -4
- data/sig/generated/nukadoko/schema.rbs +22 -4
- data/sig/generated/nukadoko/secrets.rbs +17 -2
- data/sig/generated/nukadoko/spaces.rbs +31 -0
- data/sig/generated/nukadoko/tree_passes.rbs +2 -2
- data/sig/generated/nukadoko.rbs +11 -0
- data/skills/nukadoko/SKILL.md +2 -2
- data/skills/nukadoko/references/diagnosing.md +1 -1
- data/skills/nukadoko/references/examples/http-api.md +19 -16
- data/skills/nukadoko/references/fixtures.md +1 -1
- data/skills/nukadoko/references/perturbed-worlds.md +8 -6
- data/skills/nukadoko/references/program.md +20 -20
- data/skills/nukadoko/references/running.md +2 -2
- data/skills/nukadoko/references/scenario-rules.md +2 -2
- data/skills/nukadoko/references/verdicts.md +3 -3
- data/skills/nukadoko/references/writing-steps.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +6 -6
- metadata +13 -1
|
@@ -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
|
|
@@ -6,6 +6,40 @@
|
|
|
6
6
|
module Nukadoko
|
|
7
7
|
module Engine
|
|
8
8
|
class Pattern
|
|
9
|
+
CE: untyped
|
|
10
|
+
|
|
11
|
+
# The built-in parameter types as the JavaScript package defines them.
|
|
12
|
+
# The gem's own differ: its \s takes no Unicode space, so {word} read
|
|
13
|
+
# "a<no-break space>b" as one word, and its float takes no "1." prefix
|
|
14
|
+
# or the lookahead JavaScript's does, so a line bound to one step in
|
|
15
|
+
# one engine and to none in the other. A value is what the JavaScript
|
|
16
|
+
# transformer gives: Number for an integer (a double past 2**53),
|
|
17
|
+
# parseFloat for a float, and the matched text for a bigdecimal.
|
|
18
|
+
class Registry < Cucumber::CucumberExpressions::ParameterTypeRegistry
|
|
19
|
+
INTEGER: untyped
|
|
20
|
+
|
|
21
|
+
FLOAT: ::Regexp
|
|
22
|
+
|
|
23
|
+
WORD: ::Regexp
|
|
24
|
+
|
|
25
|
+
STRING: untyped
|
|
26
|
+
|
|
27
|
+
ANONYMOUS: ::Regexp
|
|
28
|
+
|
|
29
|
+
DECIMAL: ::Regexp
|
|
30
|
+
|
|
31
|
+
# JavaScript's Number of a text of digits.
|
|
32
|
+
# : (String?) -> Numeric?
|
|
33
|
+
def self.number: (String?) -> Numeric?
|
|
34
|
+
|
|
35
|
+
# JavaScript's parseFloat: the longest number at the start, or NaN.
|
|
36
|
+
# : (String?) -> Float?
|
|
37
|
+
def self.parse_float: (String?) -> Float?
|
|
38
|
+
|
|
39
|
+
# : () -> void
|
|
40
|
+
def initialize: () -> void
|
|
41
|
+
end
|
|
42
|
+
|
|
9
43
|
NAMED: ::Regexp
|
|
10
44
|
|
|
11
45
|
REGISTRY: untyped
|
|
@@ -13,8 +13,9 @@ module Nukadoko
|
|
|
13
13
|
class Poll
|
|
14
14
|
INTERVAL: ::Float
|
|
15
15
|
|
|
16
|
-
#
|
|
17
|
-
|
|
16
|
+
# `sides` gives the claim inputs of one reading (Claims.judge).
|
|
17
|
+
# : (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped], ?(^(untyped) -> ClaimSides::Inputs)?) -> void
|
|
18
|
+
def initialize: (Hash[Symbol, untyped], Array[Hash[Symbol, untyped]], Hash[Symbol, untyped], ?(^(untyped) -> ClaimSides::Inputs)?) -> void
|
|
18
19
|
|
|
19
20
|
# A reading whose observe raised is kept with the first line of the
|
|
20
21
|
# error, and the poll reads again; only a last reading that raised
|
|
@@ -33,7 +33,7 @@ module Nukadoko
|
|
|
33
33
|
# : (?Array[String]) -> Array[Environment]
|
|
34
34
|
def environments: (?Array[String]) -> Array[Environment]
|
|
35
35
|
|
|
36
|
-
# Whether
|
|
36
|
+
# Whether the config gave a program, so each step names its world.
|
|
37
37
|
# : () -> bool
|
|
38
38
|
def file?: () -> bool
|
|
39
39
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/project_files.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# The names of the files a project keeps nukadoko's settings in, one place
|
|
4
|
+
# for every part of the engine that reads, writes, or names them.
|
|
5
|
+
module Nukadoko
|
|
6
|
+
module Engine
|
|
7
|
+
CONFIG: ::String
|
|
8
|
+
|
|
9
|
+
# The program file of releases before the program moved into the
|
|
10
|
+
# config. A project may no longer hold one; a `--base` ref may.
|
|
11
|
+
LEGACY_PROGRAM: ::String
|
|
12
|
+
|
|
13
|
+
# What a `--base` run writes into a tree for the program it runs:
|
|
14
|
+
# another config whose program the tree runs, or a ref's legacy file.
|
|
15
|
+
TREE_PROGRAM: ::String
|
|
16
|
+
|
|
17
|
+
TREE_LEGACY_PROGRAM: ::String
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/project_program.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# A tree's program under test: the `program` lambda of its
|
|
4
|
+
# nukadoko.config.rb, called once. A config with no program has none, and a
|
|
5
|
+
# run starts no world for it.
|
|
6
|
+
#
|
|
7
|
+
# The program goes with the code and the criteria with the config, so a
|
|
8
|
+
# `nuka run --base` tree can hold one side's config and the other side's
|
|
9
|
+
# program. The run writes that program beside the tree's config: the other
|
|
10
|
+
# side's config as nukadoko.tree-program.rb, or a ref's program file from
|
|
11
|
+
# before the program moved into the config as
|
|
12
|
+
# nukadoko.tree-legacy-program.rb. A project's own program file is refused,
|
|
13
|
+
# with the move to make. Boundary: reading the program; starting it is
|
|
14
|
+
# Program's.
|
|
15
|
+
module Nukadoko
|
|
16
|
+
module Engine
|
|
17
|
+
module ProjectProgram
|
|
18
|
+
LIB: untyped
|
|
19
|
+
|
|
20
|
+
UPGRADING: ::String
|
|
21
|
+
|
|
22
|
+
# The program of the tree at `root`, whose config is already loaded.
|
|
23
|
+
# : (String) -> Hash[Symbol, untyped]
|
|
24
|
+
def self.read: (String) -> Hash[Symbol, untyped]
|
|
25
|
+
|
|
26
|
+
# Nukadoko.program called from the config would describe a program
|
|
27
|
+
# nothing reads, so it is refused rather than left unstarted.
|
|
28
|
+
# : () -> Refusal
|
|
29
|
+
def self.called_in_config: () -> Refusal
|
|
30
|
+
|
|
31
|
+
# : () -> Refusal
|
|
32
|
+
def self.moved: () -> Refusal
|
|
33
|
+
|
|
34
|
+
# What a config's `program` returns, or nil when it has none.
|
|
35
|
+
# : (untyped, String) -> Hash[Symbol, untyped]?
|
|
36
|
+
def self.called: (untyped, String) -> Hash[Symbol, untyped]?
|
|
37
|
+
|
|
38
|
+
# The program `file` gives, read in a process of its own, since
|
|
39
|
+
# loading it here would replace this tree's config and fixtures: a
|
|
40
|
+
# config's program, or the options a legacy file passes to
|
|
41
|
+
# Nukadoko.program. Raises a Refusal naming the file when it does not
|
|
42
|
+
# load.
|
|
43
|
+
# : (String, legacy: bool) -> Hash[Symbol, untyped]?
|
|
44
|
+
def self.elsewhere: (String, legacy: bool) -> Hash[Symbol, untyped]?
|
|
45
|
+
|
|
46
|
+
# The text of a config with its program lambda cut out, so a change to
|
|
47
|
+
# the program alone leaves the config's mapping as it was: the
|
|
48
|
+
# program goes with the code, and a `--base` run compares only what
|
|
49
|
+
# decides how the criteria are read. A config with no program, or
|
|
50
|
+
# with more than one `program:` key, is read whole.
|
|
51
|
+
# : (String) -> String
|
|
52
|
+
def self.mapping_text: (String) -> String
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -8,13 +8,14 @@ module Nukadoko
|
|
|
8
8
|
module Engine
|
|
9
9
|
class Run
|
|
10
10
|
# `world` is head for a run, or base or old for a tree's pass, which
|
|
11
|
-
# writes into the head run's directory `dir
|
|
11
|
+
# writes into the head run's directory `dir`, and reads its env files
|
|
12
|
+
# from `head`'s root, with head's secrets as well as its own. `base` is the
|
|
12
13
|
# comparison a `--base` run judges its rows by. `scenarios` are in the
|
|
13
14
|
# run's order, which every round of every pass keeps; `records`, when
|
|
14
15
|
# given, gets each scenario's run.json entry as one line as it ends,
|
|
15
16
|
# and `rerun` is what a shuffled run's rerun lines name.
|
|
16
|
-
# : (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?) -> void
|
|
17
|
-
def initialize: (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?) -> void
|
|
17
|
+
# : (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?, ?head: Hash[Symbol, untyped]?) -> void
|
|
18
|
+
def initialize: (String, Array[singleton(Step)], Array[Scenario], Hash[Symbol, untyped], ?environments: Array[Environment]?, ?left_out: Integer, ?out: untyped, ?world: String, ?dir: String?, ?base: Base?, ?env_flags: Array[String], ?repeat: Integer, ?concurrency: Integer, ?order: Hash[Symbol, untyped], ?records: IO?, ?rerun: untyped, ?walk: WalkFiles::Handle?, ?head: Hash[Symbol, untyped]?) -> void
|
|
18
19
|
|
|
19
20
|
# : () -> Hash[Symbol, untyped]
|
|
20
21
|
def call: () -> Hash[Symbol, untyped]
|
|
@@ -188,6 +189,12 @@ module Nukadoko
|
|
|
188
189
|
|
|
189
190
|
private
|
|
190
191
|
|
|
192
|
+
# A value as a record stores it: JSON has no NaN or Infinity, and
|
|
193
|
+
# JavaScript writes either as null, so an arg a {float} read as "-"
|
|
194
|
+
# reaches the record the TypeScript engine writes.
|
|
195
|
+
# : (untyped) -> untyped
|
|
196
|
+
def stored: (untyped) -> untyped
|
|
197
|
+
|
|
191
198
|
# Runs one step whose args the block binds, and writes its record and
|
|
192
199
|
# HTTP log into `dir`.
|
|
193
200
|
# : (singleton(Step), Hash[Symbol, untyped], String, World, then_line: bool, at_line: Integer?, results: Array[untyped], origins: Hash[String, String]) { () -> [Hash[String, untyped], Hash[String, String]] } -> Hash[Symbol, untyped]
|
|
@@ -59,14 +59,15 @@ module Nukadoko
|
|
|
59
59
|
# and item claim as declared, how many items the list held and how
|
|
60
60
|
# many `where` selected, and the judged items, the broken first, at
|
|
61
61
|
# most 20, in index order.
|
|
62
|
-
# : (Hash[Symbol, untyped],
|
|
63
|
-
def self?.each_claim: (Hash[Symbol, untyped],
|
|
62
|
+
# : (Hash[Symbol, untyped], Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], ?patterns: Array[String]) -> Hash[Symbol, untyped]
|
|
63
|
+
def self?.each_claim: (Hash[Symbol, untyped], Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], ?patterns: Array[String]) -> Hash[Symbol, untyped]
|
|
64
64
|
|
|
65
65
|
# : (Hash[Symbol, untyped], untyped, Hash[String, String], Hash[String, String?], Array[String], untyped) -> Hash[Symbol, untyped]
|
|
66
66
|
def self?.item_declaration: (Hash[Symbol, untyped], untyped, Hash[String, String], Hash[String, String?], Array[String], untyped) -> Hash[Symbol, untyped]
|
|
67
67
|
|
|
68
|
-
#
|
|
69
|
-
|
|
68
|
+
# One where or item claim on one item, judged on the side the item gives.
|
|
69
|
+
# : (Hash[Symbol, untyped], Engine::ClaimSides::Side, Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], Array[String]) -> Hash[Symbol, untyped]
|
|
70
|
+
def self?.item_comparison: (Hash[Symbol, untyped], Engine::ClaimSides::Side, Engine::ClaimSides::Inputs, Hash[String, String], Hash[String, String?], Array[String]) -> Hash[Symbol, untyped]
|
|
70
71
|
|
|
71
72
|
# The claims of a scenario's step records, counted by outcome, in the
|
|
72
73
|
# fields run.json gives them.
|
|
@@ -74,11 +74,13 @@ module Nukadoko
|
|
|
74
74
|
# : (Hash[String, untyped]) -> untyped
|
|
75
75
|
def load: (Hash[String, untyped]) -> untyped
|
|
76
76
|
|
|
77
|
-
# Every way `value` departs from the schema, as `path: problem` lines
|
|
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.
|
|
78
79
|
# A key the schema does not declare is no problem: as a zod object does,
|
|
79
|
-
# the schema drops it (`strip`), and `dropped` names where.
|
|
80
|
-
#
|
|
81
|
-
|
|
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]
|
|
82
84
|
|
|
83
85
|
# The value with every key the schema does not declare left out, at any
|
|
84
86
|
# depth, with string keys. Assumes `problems` found none.
|
|
@@ -105,9 +107,25 @@ module Nukadoko
|
|
|
105
107
|
# : (untyped, untyped, String) -> Array[String]
|
|
106
108
|
def self.dropped_type: (untyped, untyped, String) -> Array[String]
|
|
107
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
|
+
|
|
108
122
|
# : (untyped, untyped, String) -> Array[String]
|
|
109
123
|
def self.type_problems: (untyped, untyped, String) -> Array[String]
|
|
110
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
|
+
|
|
111
129
|
# The JSON Schema `nuka describe` prints, as zod's own conversion gives it:
|
|
112
130
|
# the root is closed, and an inner object is closed only on the output
|
|
113
131
|
# side (`returns`), where zod drops the keys it does not declare.
|
|
@@ -82,12 +82,27 @@ module Nukadoko
|
|
|
82
82
|
# : Hash[String, String]
|
|
83
83
|
attr_reader values: untyped
|
|
84
84
|
|
|
85
|
-
#
|
|
86
|
-
|
|
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
|
|
87
92
|
|
|
88
93
|
# : () -> bool
|
|
89
94
|
def empty?: () -> bool
|
|
90
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
|
+
|
|
91
106
|
# A copy of `value` with every secret spelling in its strings and
|
|
92
107
|
# keys written as its token. Two keys that redact to one would lose
|
|
93
108
|
# a subtree, so that raises.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Generated from lib/nukadoko/spaces.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
# Responsibility: the spaces JavaScript's trim, trimEnd, and \s take, so a
|
|
4
|
+
# text the Ruby engine trims ends where the TypeScript engine's does.
|
|
5
|
+
# Ruby's strip takes a NUL and no Unicode space, and [[:space:]] takes
|
|
6
|
+
# U+0085, which JavaScript keeps; a page's text often ends in a no-break
|
|
7
|
+
# space, so either would judge a claim the other way.
|
|
8
|
+
module Nukadoko
|
|
9
|
+
module Engine
|
|
10
|
+
module Spaces
|
|
11
|
+
CLASS: ::String
|
|
12
|
+
|
|
13
|
+
SPACE: ::Regexp
|
|
14
|
+
|
|
15
|
+
LEADING: ::Regexp
|
|
16
|
+
|
|
17
|
+
TRAILING: ::Regexp
|
|
18
|
+
|
|
19
|
+
BLANK: ::Regexp
|
|
20
|
+
|
|
21
|
+
# : (String) -> String
|
|
22
|
+
def self.trim: (String) -> String
|
|
23
|
+
|
|
24
|
+
# : (String) -> String
|
|
25
|
+
def self.trim_end: (String) -> String
|
|
26
|
+
|
|
27
|
+
# : (String) -> bool
|
|
28
|
+
def self.blank?: (String) -> bool
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -17,8 +17,8 @@ module Nukadoko
|
|
|
17
17
|
|
|
18
18
|
# `judged_by` says why head's passing executions of a row judged no
|
|
19
19
|
# claim in Then position (Run.then_judged_by).
|
|
20
|
-
# : (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped) -> void
|
|
21
|
-
def initialize: (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped) -> void
|
|
20
|
+
# : (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped, ?head_root: String) -> void
|
|
21
|
+
def initialize: (Base, Array[Scenario], Hash[Scenario, Array[Hash[Symbol, untyped]]], Array[Environment], String, IO, ?^(Scenario) -> untyped, ?head_root: String) -> void
|
|
22
22
|
|
|
23
23
|
# The worlds each tree's passes started, as run.json names them.
|
|
24
24
|
attr_reader worlds: untyped
|
data/sig/generated/nukadoko.rbs
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
# Generated from lib/nukadoko.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module Nukadoko
|
|
4
|
+
# What a program file of a release before the program moved into the
|
|
5
|
+
# config calls. Only a `--base` ref still holds one, and the run reads it
|
|
6
|
+
# in a process of its own (Engine::ProjectProgram.elsewhere).
|
|
4
7
|
# : (**untyped) -> Hash[Symbol, untyped]
|
|
5
8
|
def self.program: (**untyped) -> Hash[Symbol, untyped]
|
|
6
9
|
|
|
10
|
+
# : () -> Hash[Symbol, untyped]?
|
|
11
|
+
def self.legacy_program: () -> Hash[Symbol, untyped]?
|
|
12
|
+
|
|
13
|
+
# The program under test of the project whose config load_project read.
|
|
7
14
|
# : () -> Hash[Symbol, untyped]
|
|
8
15
|
def self.program_options: () -> Hash[Symbol, untyped]
|
|
9
16
|
|
|
17
|
+
# Loads the config of the project at `root`, and reads its program.
|
|
18
|
+
# : (String) -> void
|
|
19
|
+
def self.load_project: (String) -> void
|
|
20
|
+
|
|
10
21
|
# : (**untyped) -> Hash[Symbol, untyped]
|
|
11
22
|
def self.config: (**untyped) -> Hash[Symbol, untyped]
|
|
12
23
|
|
data/skills/nukadoko/SKILL.md
CHANGED
|
@@ -23,7 +23,7 @@ touch, then one line for each of these that applies:
|
|
|
23
23
|
- A `mutates: true` step that reaches past the project (a real service, a
|
|
24
24
|
shared database, a file outside `scratch`) gets a go-ahead before its first
|
|
25
25
|
`nuka do`, once, not on every retry. A step that writes only under `scratch`,
|
|
26
|
-
or only to a server a fixture or `nukadoko.
|
|
26
|
+
or only to a server a fixture or the program in `nukadoko.config.ts` started, needs none
|
|
27
27
|
(`references/writing-steps.md`, "Asking before a step changes something").
|
|
28
28
|
- A step that needs `page`, `context`, `pageAs`, or `request` needs the project's
|
|
29
29
|
own `playwright`; `nuka check` reports `playwright-missing` with the
|
|
@@ -43,7 +43,7 @@ never commits, pushes, or publishes. Keep the narration short.
|
|
|
43
43
|
|
|
44
44
|
Run `nuka` from the directory that holds the config, and `nuka init` first
|
|
45
45
|
when there is none (`references/running.md`, "Setting up"); an app to start
|
|
46
|
-
needs `nukadoko.
|
|
46
|
+
needs the program in `nukadoko.config.ts` (`references/program.md`). A Ruby project
|
|
47
47
|
writes steps as the "Ruby" section of `llms.txt` says. Pick one line:
|
|
48
48
|
|
|
49
49
|
1. **Prose only** (a ticket, a request, a conversation):
|
|
@@ -99,7 +99,7 @@ a question for the person. A table the program writes for its own
|
|
|
99
99
|
bookkeeping (a telemetry row) or to run (a cache entry, a migration row) is
|
|
100
100
|
the program's to declare: a `lists.tables` command prints
|
|
101
101
|
`{"table":"events","holds":"bookkeeping"}` (or `"infrastructure"`) from
|
|
102
|
-
where the program already says it, never from a list in the
|
|
102
|
+
where the program already says it, never from a list in the config,
|
|
103
103
|
and a `db` count that names no `table` then leaves those lines out. The
|
|
104
104
|
line ends `left out 1 line: db insert into events (bookkeeping)`, and
|
|
105
105
|
`events_read.<key>.left_out` names each group. Otherwise the implementation
|