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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +417 -0
- data/README.ja.md +62 -7
- data/README.md +19 -5
- data/exe/nuka +8 -0
- data/lib/nukadoko/aria_snapshot.rb +1008 -0
- data/lib/nukadoko/aria_tree.rb +150 -0
- data/lib/nukadoko/base.rb +294 -0
- data/lib/nukadoko/check.rb +669 -22
- data/lib/nukadoko/claim_check.rb +177 -0
- data/lib/nukadoko/claim_check_run.rb +293 -0
- data/lib/nukadoko/claim_line.rb +381 -0
- data/lib/nukadoko/claim_rules.rb +519 -0
- data/lib/nukadoko/claim_sides.rb +469 -0
- data/lib/nukadoko/claims.rb +576 -37
- data/lib/nukadoko/cli.rb +814 -22
- data/lib/nukadoko/codes.json +947 -0
- data/lib/nukadoko/codes.rb +19 -0
- data/lib/nukadoko/command.rb +214 -12
- data/lib/nukadoko/criteria.rb +172 -0
- data/lib/nukadoko/definition.rb +33 -41
- data/lib/nukadoko/env_check.rb +88 -0
- data/lib/nukadoko/features.rb +80 -10
- data/lib/nukadoko/fixtures.rb +329 -11
- data/lib/nukadoko/http_recording.rb +68 -0
- data/lib/nukadoko/init.rb +129 -0
- data/lib/nukadoko/js_json.rb +274 -0
- data/lib/nukadoko/js_pattern.rb +531 -0
- data/lib/nukadoko/judge.rb +221 -0
- data/lib/nukadoko/judgment_file.rb +78 -0
- data/lib/nukadoko/judgments.rb +256 -0
- data/lib/nukadoko/literal.rb +129 -0
- data/lib/nukadoko/measured.rb +105 -0
- data/lib/nukadoko/order.rb +84 -0
- data/lib/nukadoko/parts.rb +43 -22
- data/lib/nukadoko/pattern.rb +73 -3
- data/lib/nukadoko/poll.rb +21 -8
- data/lib/nukadoko/program.rb +105 -17
- data/lib/nukadoko/project_files.rb +17 -0
- data/lib/nukadoko/project_fixtures.rb +17 -2
- data/lib/nukadoko/project_program.rb +119 -0
- data/lib/nukadoko/report_allure.rb +751 -0
- data/lib/nukadoko/report_messages.rb +167 -0
- data/lib/nukadoko/report_run.rb +169 -0
- data/lib/nukadoko/run.rb +898 -91
- data/lib/nukadoko/run_record.rb +535 -0
- data/lib/nukadoko/scaffold.rb +1015 -0
- data/lib/nukadoko/schema.rb +120 -21
- data/lib/nukadoko/secrets.rb +375 -0
- data/lib/nukadoko/selection.rb +163 -0
- data/lib/nukadoko/signature.rb +4 -1
- data/lib/nukadoko/skill.rb +36 -0
- data/lib/nukadoko/spaces.rb +28 -0
- data/lib/nukadoko/step.rb +68 -21
- data/lib/nukadoko/summary.rb +662 -0
- data/lib/nukadoko/table.rb +34 -2
- data/lib/nukadoko/text_fit.rb +179 -0
- data/lib/nukadoko/trace.rb +244 -0
- data/lib/nukadoko/trace_actions.rb +116 -0
- data/lib/nukadoko/tree_passes.rb +122 -0
- data/lib/nukadoko/verdict.rb +128 -0
- data/lib/nukadoko/version.rb +2 -1
- data/lib/nukadoko/vocabulary.rb +6 -0
- data/lib/nukadoko/walk.rb +305 -0
- data/lib/nukadoko/walk_files.rb +473 -0
- data/lib/nukadoko/walk_step.rb +149 -0
- data/lib/nukadoko.rb +60 -2
- data/llms.txt +297 -0
- data/sig/generated/nukadoko/aria_snapshot.rbs +331 -0
- data/sig/generated/nukadoko/aria_tree.rbs +142 -0
- data/sig/generated/nukadoko/base.rbs +142 -0
- data/sig/generated/nukadoko/check.rbs +255 -0
- data/sig/generated/nukadoko/claim_check.rbs +118 -0
- data/sig/generated/nukadoko/claim_check_run.rbs +88 -0
- data/sig/generated/nukadoko/claim_line.rbs +158 -0
- data/sig/generated/nukadoko/claim_rules.rbs +172 -0
- data/sig/generated/nukadoko/claim_sides.rbs +207 -0
- data/sig/generated/nukadoko/claims.rbs +208 -0
- data/sig/generated/nukadoko/cli.rbs +182 -0
- data/sig/generated/nukadoko/codes.rbs +16 -0
- data/sig/generated/nukadoko/command.rbs +109 -0
- data/sig/generated/nukadoko/criteria.rbs +83 -0
- data/sig/generated/nukadoko/definition.rbs +30 -0
- data/sig/generated/nukadoko/env_check.rbs +34 -0
- data/sig/generated/nukadoko/features.rbs +101 -0
- data/sig/generated/nukadoko/fixtures.rbs +175 -0
- data/sig/generated/nukadoko/http_recording.rbs +29 -0
- data/sig/generated/nukadoko/init.rbs +64 -0
- data/sig/generated/nukadoko/js_json.rbs +109 -0
- data/sig/generated/nukadoko/js_pattern.rbs +194 -0
- data/sig/generated/nukadoko/judge.rbs +64 -0
- data/sig/generated/nukadoko/judgment_file.rbs +39 -0
- data/sig/generated/nukadoko/judgments.rbs +120 -0
- data/sig/generated/nukadoko/literal.rbs +71 -0
- data/sig/generated/nukadoko/measured.rbs +42 -0
- data/sig/generated/nukadoko/order.rbs +54 -0
- data/sig/generated/nukadoko/parts.rbs +35 -0
- data/sig/generated/nukadoko/pattern.rbs +62 -0
- data/sig/generated/nukadoko/poll.rbs +41 -0
- data/sig/generated/nukadoko/program.rbs +101 -0
- data/sig/generated/nukadoko/project_files.rbs +19 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +57 -0
- data/sig/generated/nukadoko/project_program.rbs +55 -0
- data/sig/generated/nukadoko/report_allure.rbs +268 -0
- data/sig/generated/nukadoko/report_messages.rbs +68 -0
- data/sig/generated/nukadoko/report_run.rbs +102 -0
- data/sig/generated/nukadoko/run.rbs +264 -0
- data/sig/generated/nukadoko/run_record.rbs +175 -0
- data/sig/generated/nukadoko/scaffold.rbs +328 -0
- data/sig/generated/nukadoko/schema.rbs +155 -0
- data/sig/generated/nukadoko/secrets.rbs +172 -0
- data/sig/generated/nukadoko/selection.rbs +73 -0
- data/sig/generated/nukadoko/signature.rbs +17 -0
- data/sig/generated/nukadoko/skill.rbs +20 -0
- data/sig/generated/nukadoko/spaces.rbs +31 -0
- data/sig/generated/nukadoko/step.rbs +115 -0
- data/sig/generated/nukadoko/summary.rbs +204 -0
- data/sig/generated/nukadoko/table.rbs +43 -0
- data/sig/generated/nukadoko/text_fit.rbs +70 -0
- data/sig/generated/nukadoko/trace.rbs +127 -0
- data/sig/generated/nukadoko/trace_actions.rbs +40 -0
- data/sig/generated/nukadoko/tree_passes.rbs +48 -0
- data/sig/generated/nukadoko/verdict.rbs +56 -0
- data/sig/generated/nukadoko/version.rbs +5 -0
- data/sig/generated/nukadoko/vocabulary.rbs +25 -0
- data/sig/generated/nukadoko/walk.rbs +139 -0
- data/sig/generated/nukadoko/walk_files.rbs +189 -0
- data/sig/generated/nukadoko/walk_step.rbs +50 -0
- data/sig/generated/nukadoko.rbs +26 -0
- data/sig/nukadoko.rbs +5 -48
- data/skills/nukadoko/SKILL.md +120 -0
- data/skills/nukadoko/references/checking-steps.md +200 -0
- data/skills/nukadoko/references/diagnosing.md +200 -0
- data/skills/nukadoko/references/done.md +99 -0
- data/skills/nukadoko/references/evidence.md +124 -0
- data/skills/nukadoko/references/examples/cli.md +230 -0
- data/skills/nukadoko/references/examples/http-api.md +342 -0
- data/skills/nukadoko/references/examples/workflow.md +173 -0
- data/skills/nukadoko/references/exploring.md +184 -0
- data/skills/nukadoko/references/fixtures.md +198 -0
- data/skills/nukadoko/references/from-prose.md +51 -0
- data/skills/nukadoko/references/judgments.md +95 -0
- data/skills/nukadoko/references/maintenance.md +97 -0
- data/skills/nukadoko/references/merge-risk.md +74 -0
- data/skills/nukadoko/references/parts.md +152 -0
- data/skills/nukadoko/references/perturbed-worlds.md +109 -0
- data/skills/nukadoko/references/program.md +200 -0
- data/skills/nukadoko/references/reviewing.md +200 -0
- data/skills/nukadoko/references/running.md +200 -0
- data/skills/nukadoko/references/scenario-rules.md +188 -0
- data/skills/nukadoko/references/states.md +66 -0
- data/skills/nukadoko/references/step-files.md +200 -0
- data/skills/nukadoko/references/verdicts.md +200 -0
- data/skills/nukadoko/references/writing-steps.md +200 -0
- data/skills/nukadoko/references/writing-the-feature.md +165 -0
- data/skills/nukadoko/scripts/claude-code-verdict-hook.mjs +99 -0
- data/skills/nukadoko/scripts/merge-risk.jq +56 -0
- data/skills/nukadoko-verification/SKILL.md +263 -0
- metadata +133 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0efeb0fd04363a9a701f5b2f80d6d93eb751c73c40d407f759fcf7429c4c2d75
|
|
4
|
+
data.tar.gz: dbbe4722b0d2f7c00a23bcd63af502bd0e9567f431569c98f767cbbf6a6392de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0c925c96e0dddd666eba72f2ac9f8a430b7143ee97af6a3d2b4055e18b3076025f8b634352468e0a49aa1d428030558f632c4a708de2a73658b308f958ea6e4
|
|
7
|
+
data.tar.gz: 28d4a9a558783d882847b38ef3752cb0e58f7f40dadd27e8a6585d9b5df2c555edb37bfca96f7741aef9e6705558723ef36d4ad83493089ac1e58c09be87d47d
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,423 @@ notes come from the section below whose heading starts with `## [<version>]`.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.3.0] - 2026-11-16
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- **The program moves into the config.** `nukadoko.program.rb` and
|
|
14
|
+
`Nukadoko.program` are gone: the program under test is `program:` in
|
|
15
|
+
`Nukadoko.config`, a lambda that returns the options
|
|
16
|
+
`Nukadoko.program` took, as the TypeScript engine's `program` is. A
|
|
17
|
+
`nuka run --base` compares the config with that lambda cut out, so a
|
|
18
|
+
change to how the program starts is no change to any criterion, and an
|
|
19
|
+
environment's `conditions` and `defaultEnvironments` are compared as
|
|
20
|
+
before. A project root that still holds `nukadoko.program.rb` stops
|
|
21
|
+
every command with `program-file-moved` (exit code 2):
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
refused program-file-moved - nukadoko.program.rb is no longer read: the program under test is part of nukadoko.config.rb now, so nukadoko does not start what nukadoko.program.rb describes.
|
|
25
|
+
fix: Move what nukadoko.program.rb describes into nukadoko.config.rb as its program, and delete nukadoko.program.rb; CHANGELOG.md, under "The program moves into the config", shows the move.
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`Nukadoko.program` called from the config is refused with
|
|
29
|
+
`config-invalid`. To upgrade, move the options into the config and
|
|
30
|
+
delete `nukadoko.program.rb`. Before:
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
# nukadoko.program.rb
|
|
34
|
+
Nukadoko.program serve: { command: "bin/rails server -p {port}", ready: "/up" }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
After:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
# nukadoko.config.rb
|
|
41
|
+
Nukadoko.config(
|
|
42
|
+
program: -> { { serve: { command: "bin/rails server -p {port}", ready: "/up" } } },
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Then run `nuka check` until it is green. A `--base` ref from before
|
|
47
|
+
the move needs nothing: the run still reads that ref's program file for
|
|
48
|
+
its base world.
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- An `is-a "url"` claim takes what the TypeScript engine's WHATWG URL
|
|
53
|
+
parser takes: a host or a path in any script (`http://例え.jp/`), `{`, `}`,
|
|
54
|
+
and `|` in a path or a fragment, and extra slashes after the scheme. It
|
|
55
|
+
refuses a port past 65535 and a label that decodes to no letter, which
|
|
56
|
+
Ruby's URI took. Both engines now judge the same texts the same way.
|
|
57
|
+
- The `text`, `lines`, and `comma-list` views, an `is-a` kind name, and a
|
|
58
|
+
blank expected text trim the spaces JavaScript's trim takes, as the
|
|
59
|
+
TypeScript engine does: a no-break space, an ideographic space, a byte
|
|
60
|
+
order mark, and a line separator. They no longer take a NUL or a next
|
|
61
|
+
line (U+0085). A `comma-list` keeps the empty item after a comma at the
|
|
62
|
+
end, and a docstring that ends in an empty line keeps it in a criterion.
|
|
63
|
+
- A screenshot nukadoko takes (a scenario's `final.png`, a judged view's
|
|
64
|
+
`page.png`, and a `nuka run --step` pause's `page.png`) covers in black
|
|
65
|
+
each element that shows a loaded secret, as text or as a field's value,
|
|
66
|
+
as the TypeScript engine does. When those elements are not found within
|
|
67
|
+
5 seconds, no screenshot is written. A judged view and a pause show the
|
|
68
|
+
caret.
|
|
69
|
+
- A `--base` run's base and old passes read their env files from head's
|
|
70
|
+
checkout, which holds the ones git ignores, and redact with head's
|
|
71
|
+
secrets as well as the tree's own, as the TypeScript engine does.
|
|
72
|
+
- A `matches` claim reads its pattern as JavaScript's `RegExp` does, as
|
|
73
|
+
the TypeScript engine does, and no longer as a Ruby pattern: `^` and `$`
|
|
74
|
+
match only at the ends of the text, `\s` takes every Unicode space, an
|
|
75
|
+
escaped letter with no meaning is the letter (`\A`, `\h`), a `{` that
|
|
76
|
+
starts no count is a `{`, `[^]` takes any character, a backreference to
|
|
77
|
+
a group that did not match matches nothing, `.` takes one UTF-16 unit,
|
|
78
|
+
and a pattern JavaScript refuses (`(?i)`, `a*+`, `(?#...)`) does not
|
|
79
|
+
build, with V8's reason. A lookbehind Ruby cannot run (one of unbounded
|
|
80
|
+
length) is refused with Ruby's reason.
|
|
81
|
+
- A `has-item` claim on an array whose items are all `false` or `null`,
|
|
82
|
+
none of them of the expected value's type, breaks with the reason that
|
|
83
|
+
no item is of that type, as the TypeScript engine says, instead of
|
|
84
|
+
simply breaking.
|
|
85
|
+
- A step pattern reads its built-in parameter types as the JavaScript
|
|
86
|
+
cucumber-expressions package does, as the TypeScript engine does. A
|
|
87
|
+
`{word}` ends at any Unicode space, so a no-break space no longer joins
|
|
88
|
+
two words. A `{float}` or `{double}` takes the JavaScript pattern and
|
|
89
|
+
reads as `parseFloat` reads it (`1E3` is 1000, a lone sign is NaN). An
|
|
90
|
+
`{int}` past 2**53 is the nearest double, and a `{bigdecimal}` is the
|
|
91
|
+
text as written, not a `BigDecimal`.
|
|
92
|
+
- Args and returns that do not fit their schema fail with zod's words, as
|
|
93
|
+
the TypeScript engine's do: `args validation failed: n: Invalid input:
|
|
94
|
+
expected number, received NaN`. Args refuse a key the schema does not
|
|
95
|
+
declare (`(root): Unrecognized key: "x"`), an `unknown` field may be
|
|
96
|
+
missing, an `integer` past 2**53 is too big, and a step with `returns`
|
|
97
|
+
whose `run` gave back nil says so. An arg that is NaN no longer stops the
|
|
98
|
+
run while its step record is written: JSON has no NaN, so the record
|
|
99
|
+
holds null, as JavaScript writes it.
|
|
100
|
+
- A claim reads its value as the TypeScript engine reads it. A dotted
|
|
101
|
+
`actual` (`body.user.name`) is a path into what observe returned, not
|
|
102
|
+
one key, and a path that finds nothing breaks the claim with where the
|
|
103
|
+
walk stopped (`observe:value.user.name is undefined, since observe:value
|
|
104
|
+
has nothing at user`) instead of failing the step. A view of a value that
|
|
105
|
+
is no text, and an `at` with nothing there, break the claim with the
|
|
106
|
+
TypeScript engine's reason. A claim that compares a value with itself, or
|
|
107
|
+
with one observe received or computed as a boolean, breaks as there.
|
|
108
|
+
- A claim judges a plain JSON copy of each side, as the TypeScript engine
|
|
109
|
+
does: a whole float is the integer JavaScript holds (`2500.0` reads and
|
|
110
|
+
shows as `2500`), an object lists its index keys first, and NaN,
|
|
111
|
+
Infinity, an integer past `Number.MAX_SAFE_INTEGER`, a value of another
|
|
112
|
+
class, a value that holds itself, or one nested past 256 levels leaves
|
|
113
|
+
the claim unjudged with the reason. A step with an unjudged claim fails
|
|
114
|
+
as `claim_unjudged`, as there.
|
|
115
|
+
- `nuka run --no-check` refuses to start when a step's declaration is one
|
|
116
|
+
the TypeScript engine's `defineStep` refuses as its file loads, naming
|
|
117
|
+
the first such file, instead of leaving the step out.
|
|
118
|
+
- An `each` claim reads its array and each item's paths as the TypeScript
|
|
119
|
+
engine does, with the same reasons when a read finds nothing. It breaks
|
|
120
|
+
when a declaration's expected value is one observe received, and when a
|
|
121
|
+
`where` clause implies an item claim whatever the data (`greater-than 10`
|
|
122
|
+
then `at-least 5`), as there. A poll waits on the outcome the record holds.
|
|
123
|
+
- A json view reads its text as JavaScript's `JSON.parse` does and, when
|
|
124
|
+
the text is no JSON, gives V8's reason (`Unexpected token 'a', "a" is not
|
|
125
|
+
valid JSON`, `Expected ',' or '}' after property value in JSON at position
|
|
126
|
+
6 (line 1 column 7)`) instead of Ruby's. A text Ruby's parser takes and
|
|
127
|
+
JavaScript's refuses, such as one with a comment, is refused.
|
|
128
|
+
- A refusal or a claim reason quotes a value as JavaScript's
|
|
129
|
+
`JSON.stringify` writes it: a literal written `2.0` reads `2`, and
|
|
130
|
+
`1e20` reads `100000000000000000000`, as in the TypeScript engine's
|
|
131
|
+
text. A json view of a text that holds an unpaired surrogate escape
|
|
132
|
+
(`"\ud800"`), which JavaScript reads and a Ruby string cannot hold, is
|
|
133
|
+
refused with that reason instead of the parser's.
|
|
134
|
+
|
|
135
|
+
## [0.2.0] - 2026-11-15
|
|
136
|
+
|
|
137
|
+
### Added
|
|
138
|
+
|
|
139
|
+
- `Nukadoko.run_command` takes `input:`, the TypeScript engine's name for
|
|
140
|
+
`stdin:`, and `redact:`, the secrets a step holds itself, written as
|
|
141
|
+
`{{secret.NAME}}` in the record while the program gets the real value.
|
|
142
|
+
- Env files and secrets, as the TypeScript engine reads them:
|
|
143
|
+
`Nukadoko.config(envFiles: [...])` and an environment's own `envFiles:`
|
|
144
|
+
fill the `env` fixture, with the same parser; a file git does not track,
|
|
145
|
+
or one that differs from HEAD, is a secret source whose values are
|
|
146
|
+
written as `{{secret.NAME}}` in step records, `http.jsonl`, the process
|
|
147
|
+
output files, and what `nuka do` prints, and what a step prints goes to
|
|
148
|
+
stderr with them redacted; `secrets: { public:, redact: }`
|
|
149
|
+
adjusts one key. `nuka check` reports `env-file-missing`,
|
|
150
|
+
`environment-env-file-missing`, `env-file-skipped-line`,
|
|
151
|
+
`secrets-public-key-unknown`, `secrets-redact-key-unknown`,
|
|
152
|
+
`secrets-redact-key-too-short`, and `tracked-secret-looking-key`, and an
|
|
153
|
+
env file that cannot be read stops a command with `env-file-unreadable`.
|
|
154
|
+
- `scratch.copy(source)` gives a step a fresh scratch directory that holds
|
|
155
|
+
a copy of a file or directory of the project, as the TypeScript engine's
|
|
156
|
+
does. A missing source raises before any directory is made.
|
|
157
|
+
- A step body that names no `args:` keyword (`def run(scratch:)`) is called
|
|
158
|
+
without them, as a TypeScript step that does not read its args; it used
|
|
159
|
+
to fail with `unknown keyword: :args`.
|
|
160
|
+
- `nuka run` takes targets: feature files, `file:line` selections (a
|
|
161
|
+
Scenario line or an Examples row), and directories, walked for `.feature`
|
|
162
|
+
files. With none it runs `features/`. A file named twice runs once.
|
|
163
|
+
- `nuka run --tag <expression>`, repeatable: `@name` or `not @name`, read
|
|
164
|
+
on the scenario, its Feature line, and its Examples block.
|
|
165
|
+
- `nuka run --env <name>`, repeatable. Without it a run starts
|
|
166
|
+
`defaultEnvironments`, else every environment that declares
|
|
167
|
+
`conditions`, else `default`.
|
|
168
|
+
- The `--json` envelope of `nuka run` has `selection` (`full` or
|
|
169
|
+
`partial`) and, under `--tag`, `tag_selection`.
|
|
170
|
+
- Refusals with the TypeScript engine's codes and exit 2:
|
|
171
|
+
`target-not-found`, `line-on-directory`, `markdown-target`,
|
|
172
|
+
`no-feature-files`, `no-scenario-at-line`, `unknown-environment`,
|
|
173
|
+
`invalid-value` (an expression other than `@name` or `not @name`, or
|
|
174
|
+
`--tag` beside a line target), `invalid-arguments` (an unknown flag),
|
|
175
|
+
and `check-errors`. A `--tag` that keeps no scenario fails with
|
|
176
|
+
`nothing-selected` and exit 1.
|
|
177
|
+
- `nuka run` writes `run.json` into the run directory, the `--json`
|
|
178
|
+
envelope as a file, in the TypeScript engine's shape: the commit and
|
|
179
|
+
working tree the run judged, the environments, `counts`, each
|
|
180
|
+
scenario execution with its steps (`step_record_id`, `observed`,
|
|
181
|
+
`error` with its `kind`, `used`, and each claim with `actual_from`,
|
|
182
|
+
`expected_from`, `expected_text`, and `outcome`), and the verdict table
|
|
183
|
+
with each row's `reason`. A failed scenario is a `scenario-failed`
|
|
184
|
+
finding with the `nuka run` line that runs it again.
|
|
185
|
+
- `nuka verdict [--json]`: whether the newest run that ended judged the
|
|
186
|
+
working tree as it is now and left nothing red, from run.json and one
|
|
187
|
+
git tree id, without starting a run. It fails with `run-missing`,
|
|
188
|
+
`run-stale`, `run-partial`, the run's own failed findings, or
|
|
189
|
+
`run-failed`, and notes `working-tree-unknown` and `run-without-base`.
|
|
190
|
+
The tree id is the one the TypeScript engine computes, so either engine's
|
|
191
|
+
verdict reads the other's run.
|
|
192
|
+
- `nuka run` writes `summary.md` beside `run.json`, rendered from it alone
|
|
193
|
+
in the TypeScript engine's words: the verdict table, each red row's
|
|
194
|
+
reason and where it stopped, what the run does not show (a criterion
|
|
195
|
+
`--env` left out, a skipped check, a held row no control proved, a
|
|
196
|
+
scenario with no claim on a Then line), the conditions, each claim, the
|
|
197
|
+
findings, and the commands that rerun a failed scenario. A scenario with
|
|
198
|
+
no claim on a Then line has `judged_by: "nothing"` in run.json.
|
|
199
|
+
- `nuka report [run] --format markdown [--out <file>] [--json]` renders a
|
|
200
|
+
run directory's summary again from its run.json, the newest run when none
|
|
201
|
+
is named.
|
|
202
|
+
- `nuka clean [--dry-run] [--json]` removes the run directories and the
|
|
203
|
+
directories an earlier release left under `.nukadoko/`.
|
|
204
|
+
- A scenario whose conditions hold in no environment of the run is left
|
|
205
|
+
out and counted in `table.left_out`. When `--env` leaves out every
|
|
206
|
+
selected scenario, the run fails with `nothing-selected` and names a run
|
|
207
|
+
that meets them.
|
|
208
|
+
- `nuka run --base <ref>` judges each criterion against the commit `ref`
|
|
209
|
+
names. A criterion is new, changed, unchanged (with `renamed_from` or
|
|
210
|
+
`retagged` when its name or its other tags moved), or removed. A new or
|
|
211
|
+
changed one runs at the base too, the ref's code with head's
|
|
212
|
+
`features/`, where a Then failing in each proof run makes it `proven`
|
|
213
|
+
and anything else `unproven`. An unchanged one runs in the old world,
|
|
214
|
+
head's working tree with the ref's `features/` and config, when the
|
|
215
|
+
mapping under it changed (a file under `features/` other than a
|
|
216
|
+
`.feature`, the config file, or the program file's `conditions` or
|
|
217
|
+
`defaultEnvironments`) or it was renamed or retagged, and is `moved` when
|
|
218
|
+
it does not pass there. Both trees are made under the run directory and
|
|
219
|
+
removed when it ends. `unproven` and `moved` rows are
|
|
220
|
+
`criterion-unproven` and `criterion-moved` findings, run.json's table
|
|
221
|
+
has `base`, `mapping_changed`, and `mapping_changes`, and summary.md
|
|
222
|
+
says what the run compared with and quotes each removed criterion. A ref
|
|
223
|
+
outside git or one that names no commit is refused with
|
|
224
|
+
`base-outside-git`, `base-shallow`, or `base-ref-unknown`.
|
|
225
|
+
- `nuka do <step> [--args <json>] [--use <step-id>]...` runs one step
|
|
226
|
+
outside any scenario, in one environment, and writes its step record to
|
|
227
|
+
`.nukadoko/do/<id>/record.json` and stdout, in the TypeScript engine's
|
|
228
|
+
shape. `--use` fills the step's `from` args from an earlier record, of
|
|
229
|
+
a `do` or of a run. A step it does not know is `unknown-step`, args that
|
|
230
|
+
are not a JSON object or do not fit the contract are `step-args-invalid`,
|
|
231
|
+
and a `--use` that names no record is `step-inputs-invalid`.
|
|
232
|
+
- `nuka scaffold <name> --pattern <p> [--then] [--description <text>]
|
|
233
|
+
[--replace]` writes a step file whose body raises `not implemented:
|
|
234
|
+
<name>` until it is written, and `nuka scaffold --feature <path>` writes
|
|
235
|
+
one for each line no step matches, its pattern read by
|
|
236
|
+
cucumber-expressions' generator and its name made from the pattern's
|
|
237
|
+
words, in the TypeScript engine's words: the same notes, the same
|
|
238
|
+
commands that write each stub again, and the same refusals
|
|
239
|
+
(`file-exists`, `file-edited`, `invalid-value`, `target-not-found`).
|
|
240
|
+
`--command`, `--request`, and `--from` are refused as not here yet.
|
|
241
|
+
- `nuka init` writes `nukadoko.config.rb`, the empty `features/steps/`,
|
|
242
|
+
and the `.gitignore` entries the TypeScript engine writes, refuses with
|
|
243
|
+
`config-exists` when the config file is there, and ends with a
|
|
244
|
+
self-check that loads the config and the steps.
|
|
245
|
+
- `nuka check` reports `features-dir-missing` when there is no
|
|
246
|
+
`features/`, and `no-step-files-found` when it holds no step file.
|
|
247
|
+
- `nuka check` reports more of the TypeScript engine's findings, in its
|
|
248
|
+
words: a pattern that cannot be read (`unnamed-capture`,
|
|
249
|
+
`unterminated-capture`, `invalid-capture-key`, `duplicate-capture-key`,
|
|
250
|
+
`unknown-parameter-type`, `pattern-syntax-error`),
|
|
251
|
+
`capture-type-mismatch`, `duplicate-pattern`, `then-without-claims`,
|
|
252
|
+
`claims-outside-then`, `condition-tag-malformed`, `condition-unknown`,
|
|
253
|
+
`expects-tag-malformed`, `outline-rows-share-name`, and the vocabulary
|
|
254
|
+
half of `scenario-without-then`. A whole-project check adds the notes
|
|
255
|
+
`pattern-unbound` and `step-description-todo`.
|
|
256
|
+
- `nuka check` reports a `from` key whose producer did not run earlier in
|
|
257
|
+
the scenario, or two producers that both did (`from-order-violation`,
|
|
258
|
+
held behind `from-order-check-suppressed` while an earlier line matches
|
|
259
|
+
no step), a table or docstring that fills no single key or a key of the
|
|
260
|
+
wrong type (`table-docstring-key-mismatch`), `fixture-cycle`,
|
|
261
|
+
`fixture-scope-violation`, `condition-unmet`, `outline-does-not-run`,
|
|
262
|
+
and `feature-parse-error`. A whole-project check adds the notes
|
|
263
|
+
`fixture-unused` and `from-unused`. `unfillable-required-key` and
|
|
264
|
+
`undefined-step-check-suppressed` now say what the TypeScript engine
|
|
265
|
+
says.
|
|
266
|
+
- `nuka run --order file|shuffled|shuffled:<seed>` plays the feature files,
|
|
267
|
+
then each file's scenarios, in the order the seed names, by the
|
|
268
|
+
TypeScript engine's key, so a seed names one order in either engine. A
|
|
269
|
+
shuffled run prints its seed, writes `order` into run.json, says it in
|
|
270
|
+
summary.md, and names what ran before a failed scenario in its rerun line.
|
|
271
|
+
- `nuka run --repeat <n>` plays the selection n times and prints a
|
|
272
|
+
`repeat` line for each scenario that failed at least once.
|
|
273
|
+
`--proof-runs <n>` sets how many runs prove a control, and `--records`
|
|
274
|
+
writes each scenario record to stdout as it ends. A value none of them
|
|
275
|
+
can read is `invalid-value`.
|
|
276
|
+
- `nuka run --concurrency <n>` hands whole feature files to n worker
|
|
277
|
+
processes, round robin in the run's order, and runs a file whose
|
|
278
|
+
Feature line has `@nukadoko:serial` after them, alone. A worker that
|
|
279
|
+
ends without a record for a file it was given makes the run
|
|
280
|
+
`run-incomplete`. `nuka check` reports `serial-tag-on-scenario`.
|
|
281
|
+
- A program file's `env` is the `env` fixture, and `requireEnv` reads one
|
|
282
|
+
of its keys.
|
|
283
|
+
|
|
284
|
+
### Changed
|
|
285
|
+
|
|
286
|
+
- A step with no `returns` keeps nothing of what `run` gives back, so a
|
|
287
|
+
body that ends on a call (`register.set_discount(10)`) passes instead of
|
|
288
|
+
failing inside the engine; a Hash with keys fails with the TypeScript
|
|
289
|
+
engine's message, which names the keys the record would lose. A returns
|
|
290
|
+
failure now reads `returns validation failed:`, as there.
|
|
291
|
+
- `nuka check` lists errors, then warnings, then notes, as the TypeScript
|
|
292
|
+
engine does, and `undefined-step` names the patterned steps no line
|
|
293
|
+
binds, so a renamed sentence points at the step it was meant for.
|
|
294
|
+
- `nuka init` ends with `next:` naming the gem's `llms.txt`, as the
|
|
295
|
+
TypeScript engine names the package's, and `nuka --help` says its Ruby
|
|
296
|
+
section is how a Ruby step is written.
|
|
297
|
+
- `nuka check`'s `undefined-step` reads "No step definition matches" and
|
|
298
|
+
names `nuka scaffold --feature <file>` as its `do:`, as the TypeScript
|
|
299
|
+
engine does, and a project whose every line is undefined no longer also
|
|
300
|
+
gets `no-step-files-found`.
|
|
301
|
+
- `nuka init` adds a `scenarios` task that runs `bundle exec nuka run` to
|
|
302
|
+
a Rakefile that has none, and the config file it writes points at the
|
|
303
|
+
spec online, since the gem ships no `docs/`.
|
|
304
|
+
- `nuka --help` lists the commands by what they are for (Everyday,
|
|
305
|
+
Exploring, Upkeep), as the TypeScript engine does, and `--version`
|
|
306
|
+
prints the version. A command nuka does not have is refused, pointing at
|
|
307
|
+
`nuka --help`.
|
|
308
|
+
- A step definition `nuka check` refuses is named by the step's class
|
|
309
|
+
(`CountMatches claims[0] ...`) instead of `defineStep`, which a Ruby
|
|
310
|
+
step does not have.
|
|
311
|
+
- `nuka scaffold` takes `--command [<entry point>]`, `--cwd`, `--argv`,
|
|
312
|
+
`--request "<METHOD> <path>"`, `--body`, and `--from <step>.<key>`, as
|
|
313
|
+
the TypeScript engine does, instead of refusing them. A `--command` step
|
|
314
|
+
runs the program under Ruby in a scratch directory; a `--request` step
|
|
315
|
+
sends through the `request` fixture; a `--then --from` step with one
|
|
316
|
+
capture gets a whole claim. `--replace` knows each of these stubs again.
|
|
317
|
+
- `nuka run` prints its progress on stderr as the TypeScript engine does:
|
|
318
|
+
a `scenario i/n` line for each scenario, a `step i/n` line with its
|
|
319
|
+
status and time for each step, a failed step's first error line, the
|
|
320
|
+
producer it used, and its record, then the `steps` line, the counts,
|
|
321
|
+
the control runs, and the criteria. `--json` prints none of it.
|
|
322
|
+
- A Then step whose `observe` raises records `unobserved` with each
|
|
323
|
+
claim's `outcome: "unobserved"`, as the TypeScript engine does, instead
|
|
324
|
+
of a `step_error`.
|
|
325
|
+
- The `--json` envelope opens with `schema_version` and no longer has
|
|
326
|
+
`engine`, so both engines print the same fields.
|
|
327
|
+
- `nuka run` checks only the scenarios it selected, as the TypeScript
|
|
328
|
+
engine does, and a run stopped by `check` exits 2 with `check-errors`.
|
|
329
|
+
- Each refusal and each `nothing-selected` finding carries the TypeScript
|
|
330
|
+
engine's message, `fix`, and `do` line. `lib/nukadoko/codes.json` holds
|
|
331
|
+
the TypeScript engine's code registry, and `bin/sync-codes` writes it
|
|
332
|
+
from `nuka check --codes --json`. The text output prints `-` for a
|
|
333
|
+
finding with no place, and each `fix:` line.
|
|
334
|
+
- `nuka run --no-check` reports no finding of the check.
|
|
335
|
+
- A line no step matches fails with the TypeScript engine's message, `No
|
|
336
|
+
step definition matches "<text>"`.
|
|
337
|
+
- A program file whose `environments` declare no `conditions` and that has
|
|
338
|
+
no `defaultEnvironments` runs `default` alone, as the TypeScript engine
|
|
339
|
+
does, rather than every environment.
|
|
340
|
+
- A cell's `conditions` in run.json hold only the conditions the row's tags
|
|
341
|
+
name, each with the value the environment declares or `null`, as the
|
|
342
|
+
TypeScript engine writes them.
|
|
343
|
+
- Each step record.json `nuka run` writes is in the TypeScript engine's
|
|
344
|
+
shape: `schema_version`, `kind`, `args_origin`, `returns_dropped`,
|
|
345
|
+
the environment, world, run, and scenario it ran in, `evidence`, and
|
|
346
|
+
`observed`. A process `run_command` started is kept with its `group`,
|
|
347
|
+
the `files` it changed under its working directory, its `env`, and its
|
|
348
|
+
stdout and stderr as `process-<n>.stdout.txt` and
|
|
349
|
+
`process-<n>.stderr.txt`, and `run_command` returns `signal` and
|
|
350
|
+
`files` too. What a step changed in a scratch directory is
|
|
351
|
+
`observed.files`, and each claim names the channel its value was
|
|
352
|
+
measured in (`measured`, `expected_measured`). A claim read through a
|
|
353
|
+
view says so in `actual_from` (`as text`). http.jsonl keeps each
|
|
354
|
+
request with its `via`, `duration_ms`, and bodies as text with their
|
|
355
|
+
size, and a page's own requests are not counted as the step's.
|
|
356
|
+
- A claim on a literal names the pattern words that state it
|
|
357
|
+
(`literal:accepted`), and a step record lists the project fixtures its
|
|
358
|
+
step used, built (`setup_ms`, `at`) or `reused`.
|
|
359
|
+
- Each step gets a W3C trace id, as in the TypeScript engine. A request
|
|
360
|
+
the `request` fixture sends to the world carries a `traceparent`
|
|
361
|
+
(http.jsonl names it, with `declared_url`), and a process
|
|
362
|
+
`run_command` starts gets `TRACEPARENT`. The lines of program.log that
|
|
363
|
+
carry the step's trace id go to `program-log.txt` beside its record
|
|
364
|
+
(`observed.program_log`), and lines that came later to
|
|
365
|
+
`program-log-late.txt`. run.json's `worlds` names each world the run
|
|
366
|
+
started: its URL, commands, timings, log, and what the log held. A
|
|
367
|
+
served world's URL is `http://localhost:<port>`.
|
|
368
|
+
- A claim on `each` item is recorded with its declarations, how many
|
|
369
|
+
items there were and were selected, and each judged item, and a claim
|
|
370
|
+
step's failure message is the TypeScript engine's: one line per claim
|
|
371
|
+
that broke, with where two values part under `equal` and
|
|
372
|
+
`has-same-items`, and the item a broken `each` names. The run summary
|
|
373
|
+
writes each claim the same way, and names the record a value was
|
|
374
|
+
measured in when it is another step's.
|
|
375
|
+
- A polled claim step's record keeps each reading (`readings`), how many
|
|
376
|
+
there were (`attempts`), and its `settled` conditions with the reading
|
|
377
|
+
it stopped on, and its failure says why the poll stopped. A call a part
|
|
378
|
+
made is recorded as the TypeScript engine records it: `step`, `args`,
|
|
379
|
+
`result` or `error` with its kind, and its times. A step with a page
|
|
380
|
+
lists the Playwright calls it made (`actions`), read from its
|
|
381
|
+
trace.zip, and names the trace in `evidence`. run.json names the steps
|
|
382
|
+
a step used only when it failed.
|
|
383
|
+
- A page's documents, fetches, and XMLHttpRequests to the world carry the
|
|
384
|
+
step's traceparent, set through the Chrome DevTools Protocol. A claim
|
|
385
|
+
step that reads a page records what the page had received by the
|
|
386
|
+
judged reading (`pages`, `page_requests`) and what it showed right
|
|
387
|
+
after it (`judged_view`: its title, `judged/page.png`, and
|
|
388
|
+
`judged/page.aria.yml`).
|
|
389
|
+
- A request a step sends through Net::HTTP itself is recorded in its
|
|
390
|
+
http.jsonl with `via: "net/http"` and carries the step's traceparent,
|
|
391
|
+
so a claim on what it returned names the channel it was measured in.
|
|
392
|
+
A claim's `measured` reads the value at its `at` path, and a claim
|
|
393
|
+
whose expected value comes from `from` keeps `expected_text: null`.
|
|
394
|
+
- Claims are judged with the TypeScript engine's compares: `has-fields`,
|
|
395
|
+
`lacks-field`, `fits-text` (with `...`, `[..]`, and `[..:name]`), and
|
|
396
|
+
`is-a` (with its kinds) are judged now, and a claim whose two sides are
|
|
397
|
+
of two JSON types, or whose expected value every actual holds, breaks
|
|
398
|
+
with the TypeScript engine's `reason`. A claim nothing judged, such as a
|
|
399
|
+
`matches` pattern that ran out of time, is `unjudged`. A broken claim's
|
|
400
|
+
line names the field that does not fit, the field that is present, or
|
|
401
|
+
the line where a text stopped fitting. `nuka check` reports
|
|
402
|
+
`claim-kind-unknown`.
|
|
403
|
+
- The gem ships the signature of the whole engine, written by rbs-inline
|
|
404
|
+
from `lib/`'s comments into `sig/generated`, and CI checks `lib/` with
|
|
405
|
+
Steep. A step author's Steep reads the same `Step`, `Schema`, and fixture
|
|
406
|
+
types as before, now from that signature, and `run_command` declares
|
|
407
|
+
`timeout:` and `files:` too.
|
|
408
|
+
- `nuka check` reads a claim step's claims against the step that fills each `from` value, as the TypeScript engine does: `claim-path-unknown` for a path its `returns` does not have, `claim-field-stripped` and `claim-args-dropped` for a lacks-field on a key an object schema drops, `claim-not-an-array` for an each on a value that is never an array, and `claim-compares-itself` when both sides read one place.
|
|
409
|
+
- `nuka check` reports `claim-poll-unstated` for a claim step whose observe reaches a browser page, directly or through a project fixture, and does not state poll, and `claim-sentence-unread` for a table or docstring that fills a key no claim reads on a step with no observe.
|
|
410
|
+
- A step's claims are held to the rules the TypeScript engine's defineStep holds them to, and `nuka check` refuses the first one a step breaks with the same words: a literal no fixed word states, an is-a kind that is none, a key a claim does not have, a view or a count whose compare always breaks, a where clause that selects by the value its claim judges, a capture no claim reads, and the rest.
|
|
411
|
+
- A claim can count the items of its actual value (`count: true`) and take its expected value from what observe returned (`expected: { observe: path }`). A claim whose actual starts with a from key reads the value an earlier step returned in a step with observe too, and observe no longer receives the from value such a claim compares with what it read.
|
|
412
|
+
- `nuka check` reports, as the TypeScript engine does, a path into an each item its producer does not return, a from path the step's own args drops, a count of a value that is never an array, and an observe that receives the value its claim is compared with.
|
|
413
|
+
- A claim on an each item with no actual reads the item itself, and a record keeps an actual value of null.
|
|
414
|
+
- `fits-aria-snapshot` is judged as the TypeScript engine judges it: nukadoko takes the ARIA snapshot of the Playwright locator or page observe returns, right after each reading, and a broken claim's line shows the actual lines where the two trees part and names the first expected line that fits nothing and the nearest actual node. `nuka check` reports `claim-aria-snapshot-unreadable` and `claim-aria-snapshot-names-nothing` for a docstring or capture that states a tree no page can be judged on. A step whose claims judge a tree takes no second one into its judged view, and the run summary links each Then's judged view and names the browser the run launched.
|
|
415
|
+
- A `judged-as` claim reads its value for a judgment, as the TypeScript engine does: it compares nothing, and the run records the value with the digest a judgment cites (`for-judgment`, `value_digest`). Each row whose Then asks for one gains a `judgment` beside its verdict, read against `judgments/<feature>.json`: `pending` until a judgment cites the value, `judged` or `misses` once one does, `stale` when the value changed since, and `uncitable` when no channel of a step record holds it. A judgment other than `judged` fails the run with `judgment-<state>`, the summary counts and explains each, and under `--base` the run names the judgment files that changed. `nuka judge <file>:<line> [--run <id>] [--json]` shows the values a criterion asks a judge to read, and with `--meets` or `--misses`, `--by`, and `--because` records a judgment of them. A locator or a page is judged as its ARIA snapshot. run.json gains `limits`, and the text output ends with their counts.
|
|
416
|
+
- `nuka report --format messages` writes a run as a cucumber-messages stream, as the TypeScript engine does: one test case per execution of a required cell (a control's executions are left out), each claim step's claims as a `claims.json` attachment, each criterion's verdict as a `verdict.json` attachment, and a broken claim as the `nukadoko.ClaimBroken` exception. `nuka run` writes `sources.json` beside `run.json`, so a report reads the run directory alone. A record the report cannot read is the `report-incomplete` finding.
|
|
417
|
+
- `nuka report --format allure` writes a run as Allure results, as the TypeScript engine does: one result per execution with one step per line, each claim a child step of its Then, a failure marked with the kind its category in `categories.json` matches, and the history id allure-js-commons computes, so a result keeps the history either engine's results built up. It writes to `.nukadoko/export/allure-results` unless `--out` names another directory, and a render of the same run replaces the files the last one wrote there (the run's `exports` file lists them). A scenario that opened a page keeps a screenshot of it as the scenario ended, `final.png`, under `scenarios/<id>/`, which the result attaches.
|
|
418
|
+
- A line more than one step matches is `ambiguous` under `--no-check`, and the steps after it are skipped, as in the TypeScript engine, rather than running the first step that matches. A line no step matches is `undefined`.
|
|
419
|
+
- `nuka` reads its files and the Playwright driver's output as UTF-8 under any locale. Under `LANG=C` a browser error message with a non-ASCII character stopped the driver's reader, and the run waited forever.
|
|
420
|
+
- `nuka run <feature>:<line> --step` walks one execution of one scenario, pausing after each step until `nuka step` answers, in the TypeScript engine's files, so either engine's `nuka step` answers either engine's walk. `nuka step wait` reports where the walk stands, with a screenshot and an ARIA snapshot of the open page at each pause, and `nuka step next|stop <pause> --walk <n>` answers it. A stop skips the steps after the pause: the scenario is `stopped`, its cell `stopped@<line>`, its row red, and the run fails with `walk-stopped`. A run that selects more than one execution is refused with `step-needs-one-scenario`, another walk in progress with `walk-in-progress`, and an answer to a pause or a walk that is not current with `pause-not-current`, `pause-answered`, or `walk-not-current`. `nuka clean` keeps the run of a live walk, and run.json and the summary say the run was walked.
|
|
421
|
+
- `nuka skill path` prints the directory that holds the agent skills, which the gem now ships with `llms.txt`, as the npm package does.
|
|
422
|
+
- A control's proof runs come after every scenario of the pass has run
|
|
423
|
+
once, as in the TypeScript engine, rather than right after the control's
|
|
424
|
+
first run.
|
|
425
|
+
|
|
9
426
|
## [0.1.0] - 2026-11-14
|
|
10
427
|
|
|
11
428
|
### Added
|
data/README.ja.md
CHANGED
|
@@ -5,10 +5,13 @@ Gherkin のステップに型付きの契約を付け、シナリオのまちが
|
|
|
5
5
|
TypeScript 版と同じ feature ファイルを読み、同じ判定を返す必要があります。
|
|
6
6
|
[`../conformance/`](../conformance/README.md) のケースがそれを確かめます。
|
|
7
7
|
|
|
8
|
-
状態:
|
|
9
|
-
`
|
|
8
|
+
状態: `conformance/engine/` のすべてのシナリオを通します。
|
|
9
|
+
これらのシナリオは、`nuka` の各コマンドを両方のエンジンに対して実行します。
|
|
10
|
+
`conformance/` の 10 のケースも通します。
|
|
10
11
|
HTTP のステップ、ブラウザのステップ、コマンドラインのステップ、プロジェクトが定義するフィクスチャ、parts でできたステップ、poll する Then ステップ、`from`、docstring、Scenario Outline、条件つきの環境、control と proof run、判定表です。
|
|
11
|
-
`--base`、`nuka
|
|
12
|
+
`--base`、`--step`、`nuka do`、`nuka scaffold`、`nuka init` も動きます。
|
|
13
|
+
`nuka check` は、パターン、ステップの位置、タグ、Scenario Outline、`from` の順番、フィクスチャ、構文エラーについての指摘と、どこにも使われないステップ・フィクスチャ・`from` のキーや scaffold のままの説明についての注意を、TypeScript 版と同じく報告します。
|
|
14
|
+
`nuka init --allure` など、TypeScript 版の機能の一部はまだありません。
|
|
12
15
|
|
|
13
16
|
## インストール
|
|
14
17
|
|
|
@@ -47,21 +50,69 @@ end
|
|
|
47
50
|
|
|
48
51
|
## コマンド
|
|
49
52
|
|
|
53
|
+
- `nuka init` は、`nukadoko.config.rb`、空の `features/steps/`、`.nukadoko/` と `.env` のための `.gitignore` の行を書きます。
|
|
54
|
+
Rakefile に `scenarios` タスクがなければ、`bundle exec nuka run` を実行するタスクを足すので、人も CI も `rake scenarios` を実行します。
|
|
55
|
+
設定ファイルがすでにあれば断ります。
|
|
50
56
|
- `nuka check [--json]` は、実行前にまちがいを報告します。
|
|
51
|
-
- `nuka run [--json] [--no-check]`
|
|
57
|
+
- `nuka run [<feature[:line]|dir>...] [--tag <expression>]... [--env <name>]... [--order file|shuffled[:<seed>]] [--repeat <n>] [--concurrency <n>] [--proof-runs <n>] [--step] [--records] [--json] [--no-check]` は、選んだ world ごとにプログラムを起動し、選んだシナリオを実行して、ステップごとの記録を `.nukadoko/runs/` に書きます。
|
|
58
|
+
対象を書かなければ `features/` を実行します。
|
|
59
|
+
`--order shuffled` は、ファイルを、そしてファイルの中のシナリオを、seed が決める順番で実行します。
|
|
60
|
+
seed が同じなら、TypeScript 版と同じ順番です。
|
|
61
|
+
`--concurrency` は、feature ファイルを丸ごと、その数の worker プロセスに分けて実行します。
|
|
62
|
+
Feature の行に `@nukadoko:serial` があるファイルは、ほかのファイルのあとに 1 つずつ実行します。
|
|
63
|
+
`--repeat` は選んだシナリオをその回数だけ実行し、`--proof-runs` は control を何回実行するかを決め、`--records` はシナリオの記録を終わるたびに stdout に書きます。
|
|
64
|
+
- `nuka verdict [--json]` は、いちばん新しい run が今の作業ツリーを判定し、赤を残さなかったかを答えます。
|
|
65
|
+
run は始めません。
|
|
66
|
+
- `nuka judge <feature>:<line> [--run <id>] [--json]` は、Then が判断を求める基準(`judged-as` の claim)について、run が読んだ値を見せます。
|
|
67
|
+
`--meets` か `--misses` に `--by <who>` と `--because <一文>` を付けると、その値の判断を `judgments/<feature>.json` に記録します。
|
|
68
|
+
次の run は、この記録と照らして基準を読みます。
|
|
69
|
+
- `nuka report [run] --format markdown|messages|allure [--out <path>] [--json]` は、run を run ディレクトリだけからもう一度書きます。
|
|
70
|
+
run を名指ししなければ、いちばん新しい run を使います。
|
|
71
|
+
`markdown` は run の `summary.md` です。
|
|
72
|
+
`messages` は cucumber-messages の stream で、1 行に 1 つの envelope を書きます。
|
|
73
|
+
cucumber のプロトコルを読む formatter や JUnit のステップは、そのまま動きます。
|
|
74
|
+
claim のステップの claims と、各基準の判定は attachment として載ります。
|
|
75
|
+
`allure` は Allure の結果のディレクトリで、`--out` で別の場所を指定しなければ `.nukadoko/export/allure-results` に書きます。
|
|
76
|
+
1 回の実行が 1 つの結果になり、各 claim はその Then の子ステップになります。
|
|
77
|
+
history id は、同じシナリオについて TypeScript 版が書く結果と同じです。
|
|
78
|
+
- `nuka run <feature>:<line> --step` は、1 つのシナリオを 1 ステップずつ進めます。
|
|
79
|
+
各ステップのあと、`nuka step` が答えるまで待ちます。
|
|
80
|
+
`nuka step wait [--walk <n>] [--timeout <s>] [--json]` は、walk がいまどこにいるかを出します。
|
|
81
|
+
止まったステップ、その記録、開いたままのページのスクリーンショットと ARIA スナップショットです。
|
|
82
|
+
`nuka step next <pause> --walk <n>` は次のステップを実行し、`nuka step stop <pause> --walk <n>` は残りを飛ばします。
|
|
83
|
+
止めたシナリオは stopped になり、その行は赤になります。
|
|
84
|
+
どちらのエンジンの `nuka step` も、どちらのエンジンの walk に答えられます。
|
|
85
|
+
- `nuka clean [--dry-run] [--json]` は、`.nukadoko/` の下の run ディレクトリを消します。
|
|
86
|
+
- `nuka skill path` は、gem に入っているエージェント向けスキル(`nukadoko` と `nukadoko-verification`)のディレクトリを出します。
|
|
87
|
+
npm パッケージに入っているものと同じスキルです。
|
|
88
|
+
- `nuka do <step> [--args <json>] [--use <step-id>]...` は、シナリオの外で 1 つのステップを実行し、ステップの記録を出します。
|
|
89
|
+
`--use` は、前の記録(`do` のものでも run のものでも)から、ステップの `from` の args を埋めます。
|
|
90
|
+
- `nuka scaffold <name> [--pattern <p>] [--then] [--description <text>] [--replace]` は、`features/steps/<name>.rb` を書きます。
|
|
91
|
+
本体は、だれかが書くまで `not implemented` で失敗します。
|
|
92
|
+
`nuka scaffold --feature <path>` は、どのステップにも合わない行ごとに 1 つ書き、パターンは行から読みます。
|
|
93
|
+
`--command <entry point>` は、プログラムを Ruby で scratch ディレクトリの中で実行し、`exitCode`、`stdout`、`stderr` を返すステップを書きます。
|
|
94
|
+
`--cwd <key>` は args のキーが持つディレクトリで実行し、`--argv <key>` は 1 つのキャプチャを空白で分けて引数にします。
|
|
95
|
+
gem が入れる実行ファイルには、`bundle binstubs <gem>` が `bin/<name>` を書くので、それを `--command` に渡せます。
|
|
96
|
+
`--request "<METHOD> <path>"` は、リクエストを 1 つ送り、`status` と `body` を返すステップを書きます(`--body <key>` はその args のキーを送ります)。
|
|
97
|
+
`--from <step>.<key>` は、前のステップの returns から args のキーを埋めます。
|
|
98
|
+
`--then` とキャプチャ 1 つと一緒に使うと、claim がその 2 つを比べるので、ステップは書き直さずに使えます。
|
|
52
99
|
- ブラウザの起動設定は `nukadoko.config.rb` に `Nukadoko.config(browser: { executablePath: "..." })` と書きます。`page` を使うステップは、シナリオごとに自分のブラウザコンテキストを持ちます。ステップの記録には、ページが送ったリクエストとステップのトレースが残ります。
|
|
53
|
-
- `scratch` を使うステップは `scratch.dir` で新しいディレクトリを得ます。シナリオが終わると消えます。`Nukadoko.run_command(command, args, cwd:)` はプログラムを実行し、`{ exitCode:, stdout:, stderr: }`
|
|
100
|
+
- `scratch` を使うステップは `scratch.dir` で新しいディレクトリを得ます。シナリオが終わると消えます。`scratch.copy(source)` は、プロジェクトのファイルかディレクトリの写しを入れた新しいディレクトリを返します。`args:` キーワードを書かない本体は、args なしで呼ばれます。`Nukadoko.run_command(command, args, cwd:, env:, input:, timeout:, redact:)` はプログラムを実行し、`{ exitCode:, signal:, stdout:, stderr: }` を返します。ステップの記録には実行したプロセスが残り、`redact:` に渡した値は `{{secret.NAME}}` になります。
|
|
101
|
+
- `Nukadoko.config(envFiles: [".env"])` は env ファイルを `env` フィクスチャに読み込みます。config の `program:` の環境は、その後ろに自分の `envFiles:` を足せます。git が追跡していないファイルと HEAD と違うファイルは秘密の出どころです。その 4 文字以上の値は、ステップの記録、`http.jsonl`、`nuka do` の出力で `{{secret.NAME}}` に置き換わります。ステップが表示したものは、秘密を伏せて stderr に出ます。`secrets: { public: [...], redact: [...] }` で、そのようなキーを平文のままにしたり、追跡しているファイルのキーを伏せたりできます。`nuka check` は、無いファイル、読み飛ばした行、どのファイルにもない `secrets` のキーを警告し、値は表示しません。
|
|
54
102
|
- プロジェクトのフィクスチャは `nukadoko.config.rb` に書きます。ブロックは値を `use` に渡し、その後ろが後片付けです。例: `Nukadoko.fixture(:store) { |use| use.(Store.new) }`。`scope: :process` にすると、環境ごとの実行全体で 1 つの値を使います。
|
|
55
103
|
- `parts [CreateTodo, CompleteById]` で、ステップが呼べるステップを宣言します。`call.(CreateTodo, title: args.title)` で 1 つを実行し、args と返り値を確かめます。パターンのない part も書けます。呼び出しは、呼んだステップの記録の `calls` に残ります。`nuka check` は、`parts` の循環と、`mutates false` なのに `mutates true` の part を持つステップを報告します。
|
|
56
104
|
- `poll timeout_ms: 3000` は、すべての claim が 2 回続けて成り立つか時間切れになるまで、100 ミリ秒おきに `observe` を読み直します。`settled:` には、一度なったら変わらない状態を書きます。2 回続けてその状態なら、壊れた claim を待つのをやめます。読んだ結果はすべてステップの記録に残ります。
|
|
57
105
|
- `nuka steps [--json]` は語彙の一覧を出します。`nuka describe <step>` は 1 つのステップを、args と返り値の JSON Schema とともに出します。項目は TypeScript 版と同じです。
|
|
106
|
+
- `returns` の無いステップは、`run` が返したものを残しません。そのため本体の最後はどんな呼び出しでもかまいません。キーのある Hash を返すと、失うキーを名指しして失敗します。
|
|
58
107
|
- 契約が宣言していない返り値のキーは、zod のオブジェクトと同じく捨てられます。ステップの記録の `returns_dropped` に、捨てたキーが残ります。
|
|
59
108
|
- `nuka sig` は `sig/nukadoko/steps.rbs` を書きます。Steep を使うと、宣言していない args のキーを読む本体や、形のちがう値を返す本体がエラーになります。
|
|
60
109
|
|
|
61
|
-
|
|
110
|
+
テスト対象のプログラムは `nukadoko.config.rb` の `program:` に書きます。プログラムの起動のしかたを返すラムダです。
|
|
62
111
|
|
|
63
112
|
```ruby
|
|
64
|
-
Nukadoko.
|
|
113
|
+
Nukadoko.config(
|
|
114
|
+
program: -> { { serve: { command: "bin/rails server -p {port}", ready: "/up" } } },
|
|
115
|
+
)
|
|
65
116
|
```
|
|
66
117
|
|
|
67
118
|
## 開発
|
|
@@ -69,3 +120,7 @@ Nukadoko.program serve: { command: "bin/rails server -p {port}", ready: "/up" }
|
|
|
69
120
|
- このディレクトリで `bundle install` を実行します。
|
|
70
121
|
- `bundle exec ruby ../conformance/run-rb.rb` で、すべての検査ケースをこのエンジンで走らせます。
|
|
71
122
|
- `bundle exec bin/test` で単体テストと、`test/hegel/` の Hegel の性質テストを走らせます。gem には Ruby 3.4 以上が要ります。
|
|
123
|
+
- `bundle exec rbs-inline --output=sig/generated lib` で、`lib/` の `#:` と `# @rbs` のコメントから型の定義を書き出します。
|
|
124
|
+
`bundle exec steep check` で、`lib/` をその定義で検査します。
|
|
125
|
+
rbs-inline が書き出したものはコミットします。
|
|
126
|
+
`sig/nukadoko.rbs` には rbs-inline が書けないものを、`sig-deps/` には型の定義を持たない gem の、使っている部分を書きます。
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
The Ruby engine of [nukadoko](../README.md): typed step contracts for Gherkin, written in Ruby, so a scenario can be told wrong before it runs.
|
|
4
4
|
It reads the same feature files as the TypeScript engine and must judge them the same way; the cases in [`../conformance/`](../conformance/README.md) hold it to that.
|
|
5
5
|
|
|
6
|
-
Status:
|
|
6
|
+
Status: it passes every scenario under `conformance/engine/`, which runs each `nuka` command against both engines, and the ten cases in `conformance/`: HTTP steps, browser steps, command-line steps, fixtures a project defines, steps made of parts, polling Then steps, `from`, docstrings, Scenario Outlines, environments with conditions, controls with proof runs, and the verdict table. It runs `--base`, `--step`, `nuka do`, `nuka scaffold`, and `nuka init`. `nuka check` reports the pattern, position, tag, outline, `from` order, fixture, and parse findings the TypeScript engine reports, and its notes on unbound steps, unused fixtures, unused `from` keys, and scaffold descriptions. Some of what the TypeScript engine does is not here yet, such as `nuka init --allure`.
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
@@ -40,21 +40,34 @@ end
|
|
|
40
40
|
|
|
41
41
|
## Commands
|
|
42
42
|
|
|
43
|
+
- `nuka init` writes `nukadoko.config.rb`, the empty `features/steps/`, and the `.gitignore` entries for `.nukadoko/` and `.env` files. A Rakefile with no `scenarios` task gets one that runs `bundle exec nuka run`, so people and CI run `rake scenarios`. It refuses when the config file exists.
|
|
43
44
|
- `nuka check [--json]` reports what is wrong before anything runs.
|
|
44
|
-
- `nuka run [--json] [--no-check]` starts the program, runs
|
|
45
|
+
- `nuka run [<feature[:line]|dir>...] [--tag <expression>]... [--env <name>]... [--order file|shuffled[:<seed>]] [--repeat <n>] [--concurrency <n>] [--proof-runs <n>] [--step] [--records] [--json] [--no-check]` starts the program in each selected world, runs the selected scenarios, and writes a record per step under `.nukadoko/runs/`. With no target it runs `features/`. `--order shuffled` plays the files, then each file's scenarios, in an order a seed names, the same order the TypeScript engine plays for that seed. `--repeat` plays the selection that many times, `--concurrency` spreads whole feature files over that many worker processes (a file tagged `@nukadoko:serial` on its Feature line runs alone, after them), `--proof-runs` sets how many times each control runs, and `--records` writes each scenario record to stdout as it ends.
|
|
46
|
+
- `nuka verdict [--json]` says whether the newest run judged the working tree as it is now and left nothing red. It never starts a run.
|
|
47
|
+
- `nuka judge <feature>:<line> [--run <id>] [--json]` shows the values a run read for a criterion whose Then asks for a judgment (a `judged-as` claim). With `--meets` or `--misses`, `--by <who>`, and `--because <one sentence>` it records a judgment of them in `judgments/<feature>.json`, which the next run reads the criterion against.
|
|
48
|
+
- `nuka report [run] --format markdown|messages|allure [--out <path>] [--json]` renders a run again from its run directory alone, the newest run when none is named. `markdown` is its `summary.md`. `messages` is a cucumber-messages stream, one envelope per line, so a formatter or a JUnit step that reads cucumber's protocol keeps working: a claim step's claims and each criterion's verdict ride as attachments. `allure` is a directory of Allure results, `.nukadoko/export/allure-results` unless `--out` names another: one result per execution, each claim a child step of its Then, with the history id the TypeScript engine's results of the same scenario carry.
|
|
49
|
+
- `nuka run <feature>:<line> --step` walks one scenario a step at a time: after each step it waits until `nuka step` answers. `nuka step wait [--walk <n>] [--timeout <s>] [--json]` prints where the walk stands: the step it paused after, its record, and a screenshot and an ARIA snapshot of the page it left open. `nuka step next <pause> --walk <n>` runs the next step, and `nuka step stop <pause> --walk <n>` skips the rest, which leaves the scenario stopped and its row red. Either engine's `nuka step` answers either engine's walk.
|
|
50
|
+
- `nuka clean [--dry-run] [--json]` removes the run directories under `.nukadoko/`.
|
|
51
|
+
- `nuka skill path` prints the directory that holds the agent skills the gem ships (`nukadoko` and `nukadoko-verification`), the same skills the npm package ships.
|
|
52
|
+
- `nuka do <step> [--args <json>] [--use <step-id>]...` runs one step outside any scenario and prints its step record. `--use` fills the step's `from` args from an earlier record, of a `do` or of a run.
|
|
53
|
+
- `nuka scaffold <name> [--pattern <p>] [--then] [--description <text>] [--replace]` writes `features/steps/<name>.rb`, a step whose body raises `not implemented` until someone writes it. `nuka scaffold --feature <path>` writes one for each line no step matches, its pattern read from the line. `--command <entry point>` writes a step that runs the program under Ruby in a scratch directory and returns `exitCode`, `stdout`, and `stderr` (`--cwd <key>` runs it in the directory an args key holds, and `--argv <key>` splits one capture into its arguments). For an executable a gem installs, `bundle binstubs <gem>` writes `bin/<name>`, an entry point `--command` can run. `--request "<METHOD> <path>"` writes a step that sends one request and returns `status` and `body` (`--body <key>` sends that args key). `--from <step>.<key>` fills an args key from an earlier step's returns; with `--then` and one capture, the claim compares the two, so the step needs no edit.
|
|
45
54
|
- Browser launch options go in `nukadoko.config.rb`, as `Nukadoko.config(browser: { executablePath: "..." })`. A step that names `page` gets a browser context of its own for each scenario; each step record holds the requests the page sent and a trace of the step.
|
|
46
|
-
- A step that names `scratch` gets `scratch.dir`, a fresh directory that is removed when the scenario ends. `Nukadoko.run_command(command, args, cwd:)` runs a program and returns `{ exitCode:, stdout:, stderr: }`; the step record lists each run.
|
|
55
|
+
- A step that names `scratch` gets `scratch.dir`, a fresh directory that is removed when the scenario ends, and `scratch.copy(source)`, one that holds a copy of a file or directory of the project. A body that names no `args:` keyword is called without them. `Nukadoko.run_command(command, args, cwd:, env:, input:, timeout:, redact:)` runs a program and returns `{ exitCode:, signal:, stdout:, stderr: }`; the step record lists each run, with each `redact:` value the step holds written as `{{secret.NAME}}`.
|
|
56
|
+
- `Nukadoko.config(envFiles: [".env"])` loads env files into the `env` fixture, and an environment of the config's `program:` adds its own `envFiles:` after them. A file git does not track, or one that differs from HEAD, is a secret source: each of its values four characters or longer is written as `{{secret.NAME}}` in every step record, `http.jsonl`, and what `nuka do` prints, and what a step prints reaches stderr with them redacted. `secrets: { public: [...], redact: [...] }` keeps one such key plain, or redacts one key of a tracked file. `nuka check` warns about a missing file, a line it skipped, and a `secrets` key no file defines, and never prints a value.
|
|
47
57
|
- A project fixture goes in `nukadoko.config.rb`. The block calls `use` with the value, and what follows is the teardown: `Nukadoko.fixture(:store) { |use| use.(Store.new) }`. `scope: :process` keeps one value for the whole run of an environment.
|
|
48
58
|
- `parts [CreateTodo, CompleteById]` declares the steps a step may run, and `call.(CreateTodo, title: args.title)` runs one, with its args and returns checked. A part needs no pattern. Each call is kept under `calls` in the calling step's record. `nuka check` reports a cycle in `parts` and a `mutates false` step whose part declares `mutates true`.
|
|
49
59
|
- `poll timeout_ms: 3000` reads `observe` again, 100 ms apart, until every claim holds on two readings in a row or the time runs out. `settled:` names a state that cannot change once reached, so two settled readings in a row stop the wait for a claim that broke. Every reading is kept in the step record.
|
|
50
60
|
- `nuka steps [--json]` lists the vocabulary, and `nuka describe <step>` prints one step with the JSON Schema of its args and returns, in the fields the TypeScript engine prints.
|
|
61
|
+
- A step with no `returns` keeps nothing `run` gives back, so its body can end on any call; a Hash with keys fails, naming the keys it would lose.
|
|
51
62
|
- A returned key the contract does not declare is dropped, as a zod object drops it, and the step record names it under `returns_dropped`.
|
|
52
63
|
- `nuka sig` writes `sig/nukadoko/steps.rbs`. With Steep, a body that reads an undeclared args key or returns the wrong shape is an error.
|
|
53
64
|
|
|
54
|
-
The program under test is described in `nukadoko.
|
|
65
|
+
The program under test is described by `program:` in `nukadoko.config.rb`, a lambda that returns how the program starts:
|
|
55
66
|
|
|
56
67
|
```ruby
|
|
57
|
-
Nukadoko.
|
|
68
|
+
Nukadoko.config(
|
|
69
|
+
program: -> { { serve: { command: "bin/rails server -p {port}", ready: "/up" } } },
|
|
70
|
+
)
|
|
58
71
|
```
|
|
59
72
|
|
|
60
73
|
## Development
|
|
@@ -62,5 +75,6 @@ Nukadoko.program serve: { command: "bin/rails server -p {port}", ready: "/up" }
|
|
|
62
75
|
- `bundle install` in this directory.
|
|
63
76
|
- `bundle exec ruby ../conformance/run-rb.rb` runs every conformance case under this engine.
|
|
64
77
|
- `bundle exec bin/test` runs the unit tests and the Hegel property tests under `test/hegel/`. The gem needs Ruby 3.4 or later.
|
|
78
|
+
- `bundle exec rbs-inline --output=sig/generated lib` writes the signatures from the `#:` and `# @rbs` comments in `lib/`, and `bundle exec steep check` checks `lib/` against them. Commit what rbs-inline writes. `sig/nukadoko.rbs` holds what rbs-inline cannot write, and `sig-deps/` the parts of other gems that ship no signature.
|
|
65
79
|
|
|
66
80
|
[日本語](README.ja.md)
|
data/exe/nuka
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
# Every file and pipe nukadoko reads is UTF-8 (feature files, records, the
|
|
5
|
+
# Playwright driver's protocol). Under LANG=C the default would be
|
|
6
|
+
# US-ASCII, and the driver's reader thread dies on the first non-ASCII
|
|
7
|
+
# byte, leaving the run waiting on a reply that never comes.
|
|
8
|
+
Encoding.default_external = Encoding::UTF_8
|
|
9
|
+
|
|
4
10
|
require_relative "../lib/nukadoko"
|
|
5
11
|
require_relative "../lib/nukadoko/cli"
|
|
12
|
+
require_relative "../lib/nukadoko/judge"
|
|
13
|
+
require_relative "../lib/nukadoko/walk_step"
|
|
6
14
|
|
|
7
15
|
exit Nukadoko::CLI.new(ARGV).call
|