nukadoko 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +291 -0
  3. data/README.ja.md +58 -5
  4. data/README.md +15 -3
  5. data/exe/nuka +8 -0
  6. data/lib/nukadoko/aria_snapshot.rb +1008 -0
  7. data/lib/nukadoko/aria_tree.rb +150 -0
  8. data/lib/nukadoko/base.rb +274 -0
  9. data/lib/nukadoko/check.rb +669 -22
  10. data/lib/nukadoko/claim_check.rb +177 -0
  11. data/lib/nukadoko/claim_check_run.rb +293 -0
  12. data/lib/nukadoko/claim_line.rb +381 -0
  13. data/lib/nukadoko/claim_rules.rb +519 -0
  14. data/lib/nukadoko/claims.rb +407 -30
  15. data/lib/nukadoko/cli.rb +802 -19
  16. data/lib/nukadoko/codes.json +942 -0
  17. data/lib/nukadoko/codes.rb +19 -0
  18. data/lib/nukadoko/command.rb +214 -12
  19. data/lib/nukadoko/criteria.rb +172 -0
  20. data/lib/nukadoko/definition.rb +33 -41
  21. data/lib/nukadoko/env_check.rb +90 -0
  22. data/lib/nukadoko/features.rb +80 -10
  23. data/lib/nukadoko/fixtures.rb +296 -10
  24. data/lib/nukadoko/http_recording.rb +68 -0
  25. data/lib/nukadoko/init.rb +130 -0
  26. data/lib/nukadoko/judge.rb +221 -0
  27. data/lib/nukadoko/judgment_file.rb +78 -0
  28. data/lib/nukadoko/judgments.rb +256 -0
  29. data/lib/nukadoko/literal.rb +129 -0
  30. data/lib/nukadoko/measured.rb +105 -0
  31. data/lib/nukadoko/order.rb +84 -0
  32. data/lib/nukadoko/parts.rb +42 -21
  33. data/lib/nukadoko/pattern.rb +11 -1
  34. data/lib/nukadoko/poll.rb +17 -6
  35. data/lib/nukadoko/program.rb +105 -17
  36. data/lib/nukadoko/project_fixtures.rb +17 -2
  37. data/lib/nukadoko/report_allure.rb +751 -0
  38. data/lib/nukadoko/report_messages.rb +167 -0
  39. data/lib/nukadoko/report_run.rb +169 -0
  40. data/lib/nukadoko/run.rb +865 -88
  41. data/lib/nukadoko/run_record.rb +532 -0
  42. data/lib/nukadoko/scaffold.rb +1015 -0
  43. data/lib/nukadoko/schema.rb +61 -4
  44. data/lib/nukadoko/secrets.rb +359 -0
  45. data/lib/nukadoko/selection.rb +163 -0
  46. data/lib/nukadoko/signature.rb +4 -1
  47. data/lib/nukadoko/skill.rb +36 -0
  48. data/lib/nukadoko/step.rb +62 -21
  49. data/lib/nukadoko/summary.rb +662 -0
  50. data/lib/nukadoko/table.rb +34 -2
  51. data/lib/nukadoko/text_fit.rb +179 -0
  52. data/lib/nukadoko/trace.rb +244 -0
  53. data/lib/nukadoko/trace_actions.rb +116 -0
  54. data/lib/nukadoko/tree_passes.rb +119 -0
  55. data/lib/nukadoko/verdict.rb +128 -0
  56. data/lib/nukadoko/version.rb +2 -1
  57. data/lib/nukadoko/vocabulary.rb +6 -0
  58. data/lib/nukadoko/walk.rb +305 -0
  59. data/lib/nukadoko/walk_files.rb +473 -0
  60. data/lib/nukadoko/walk_step.rb +149 -0
  61. data/lib/nukadoko.rb +36 -0
  62. data/llms.txt +296 -0
  63. data/sig/generated/nukadoko/aria_snapshot.rbs +331 -0
  64. data/sig/generated/nukadoko/aria_tree.rbs +142 -0
  65. data/sig/generated/nukadoko/base.rbs +136 -0
  66. data/sig/generated/nukadoko/check.rbs +255 -0
  67. data/sig/generated/nukadoko/claim_check.rbs +118 -0
  68. data/sig/generated/nukadoko/claim_check_run.rbs +88 -0
  69. data/sig/generated/nukadoko/claim_line.rbs +158 -0
  70. data/sig/generated/nukadoko/claim_rules.rbs +172 -0
  71. data/sig/generated/nukadoko/claims.rbs +165 -0
  72. data/sig/generated/nukadoko/cli.rbs +182 -0
  73. data/sig/generated/nukadoko/codes.rbs +16 -0
  74. data/sig/generated/nukadoko/command.rbs +109 -0
  75. data/sig/generated/nukadoko/criteria.rbs +83 -0
  76. data/sig/generated/nukadoko/definition.rbs +30 -0
  77. data/sig/generated/nukadoko/env_check.rbs +38 -0
  78. data/sig/generated/nukadoko/features.rbs +101 -0
  79. data/sig/generated/nukadoko/fixtures.rbs +152 -0
  80. data/sig/generated/nukadoko/http_recording.rbs +29 -0
  81. data/sig/generated/nukadoko/init.rbs +66 -0
  82. data/sig/generated/nukadoko/judge.rbs +64 -0
  83. data/sig/generated/nukadoko/judgment_file.rbs +39 -0
  84. data/sig/generated/nukadoko/judgments.rbs +120 -0
  85. data/sig/generated/nukadoko/literal.rbs +71 -0
  86. data/sig/generated/nukadoko/measured.rbs +42 -0
  87. data/sig/generated/nukadoko/order.rbs +54 -0
  88. data/sig/generated/nukadoko/parts.rbs +35 -0
  89. data/sig/generated/nukadoko/pattern.rbs +28 -0
  90. data/sig/generated/nukadoko/poll.rbs +40 -0
  91. data/sig/generated/nukadoko/program.rbs +101 -0
  92. data/sig/generated/nukadoko/project_fixtures.rbs +57 -0
  93. data/sig/generated/nukadoko/report_allure.rbs +268 -0
  94. data/sig/generated/nukadoko/report_messages.rbs +68 -0
  95. data/sig/generated/nukadoko/report_run.rbs +102 -0
  96. data/sig/generated/nukadoko/run.rbs +257 -0
  97. data/sig/generated/nukadoko/run_record.rbs +174 -0
  98. data/sig/generated/nukadoko/scaffold.rbs +328 -0
  99. data/sig/generated/nukadoko/schema.rbs +137 -0
  100. data/sig/generated/nukadoko/secrets.rbs +157 -0
  101. data/sig/generated/nukadoko/selection.rbs +73 -0
  102. data/sig/generated/nukadoko/signature.rbs +17 -0
  103. data/sig/generated/nukadoko/skill.rbs +20 -0
  104. data/sig/generated/nukadoko/step.rbs +115 -0
  105. data/sig/generated/nukadoko/summary.rbs +204 -0
  106. data/sig/generated/nukadoko/table.rbs +43 -0
  107. data/sig/generated/nukadoko/text_fit.rbs +70 -0
  108. data/sig/generated/nukadoko/trace.rbs +127 -0
  109. data/sig/generated/nukadoko/trace_actions.rbs +40 -0
  110. data/sig/generated/nukadoko/tree_passes.rbs +48 -0
  111. data/sig/generated/nukadoko/verdict.rbs +56 -0
  112. data/sig/generated/nukadoko/version.rbs +5 -0
  113. data/sig/generated/nukadoko/vocabulary.rbs +25 -0
  114. data/sig/generated/nukadoko/walk.rbs +139 -0
  115. data/sig/generated/nukadoko/walk_files.rbs +189 -0
  116. data/sig/generated/nukadoko/walk_step.rbs +50 -0
  117. data/sig/generated/nukadoko.rbs +15 -0
  118. data/sig/nukadoko.rbs +5 -48
  119. data/skills/nukadoko/SKILL.md +120 -0
  120. data/skills/nukadoko/references/checking-steps.md +200 -0
  121. data/skills/nukadoko/references/diagnosing.md +200 -0
  122. data/skills/nukadoko/references/done.md +99 -0
  123. data/skills/nukadoko/references/evidence.md +124 -0
  124. data/skills/nukadoko/references/examples/cli.md +230 -0
  125. data/skills/nukadoko/references/examples/http-api.md +339 -0
  126. data/skills/nukadoko/references/examples/workflow.md +173 -0
  127. data/skills/nukadoko/references/exploring.md +184 -0
  128. data/skills/nukadoko/references/fixtures.md +198 -0
  129. data/skills/nukadoko/references/from-prose.md +51 -0
  130. data/skills/nukadoko/references/judgments.md +95 -0
  131. data/skills/nukadoko/references/maintenance.md +97 -0
  132. data/skills/nukadoko/references/merge-risk.md +74 -0
  133. data/skills/nukadoko/references/parts.md +152 -0
  134. data/skills/nukadoko/references/perturbed-worlds.md +107 -0
  135. data/skills/nukadoko/references/program.md +200 -0
  136. data/skills/nukadoko/references/reviewing.md +200 -0
  137. data/skills/nukadoko/references/running.md +200 -0
  138. data/skills/nukadoko/references/scenario-rules.md +188 -0
  139. data/skills/nukadoko/references/states.md +66 -0
  140. data/skills/nukadoko/references/step-files.md +200 -0
  141. data/skills/nukadoko/references/verdicts.md +200 -0
  142. data/skills/nukadoko/references/writing-steps.md +200 -0
  143. data/skills/nukadoko/references/writing-the-feature.md +165 -0
  144. data/skills/nukadoko/scripts/claude-code-verdict-hook.mjs +99 -0
  145. data/skills/nukadoko/scripts/merge-risk.jq +56 -0
  146. data/skills/nukadoko-verification/SKILL.md +263 -0
  147. metadata +121 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6d047ee71c9d370c302adba5f7746fc297ddb145f34a7edb4aadf19d6b9174c
4
- data.tar.gz: 9498233a5e767889d79c193ac243f0e4a14fea417bca0ace600b7391ed077916
3
+ metadata.gz: 469ec78d0a9894519a020a4cc29e409a15977d3241b8b2d90563caed7d3b71e2
4
+ data.tar.gz: a69b9814e47df79f92c0c435e48bdb5b90a97188b2421a265f891ebd6a1f2aa3
5
5
  SHA512:
6
- metadata.gz: 823e46b1d92101a548e63b42ab808d0ae3739d53179c037ce6af1ecdca5622fde9694b34b6080f646e8942c17f793ad66ed1df4a81a3cff4e816ee905a6854c9
7
- data.tar.gz: 0c768c8cd2e6ef4d3eeb28cbc02cb58be4e34b038996429687630261490db2ce95a6428ff6f243d94cc43c6f4bea4504c7710f4ac37bf46e1e8a05ea28c23169
6
+ metadata.gz: 9b1c6850c722e5186e8d6f227ef67c9f68368cc61d89706b67ea772a97e77881db3f529a04853b4c65d3eae8ddbccd645bd762f137519ad50369e060e3e579df
7
+ data.tar.gz: a667506585b11ce283a364bf910897ab38fe6b274a7979744ab2a970d5f72efbc01ff0502de9bc8aedf2225dec87d6be9f53c5596bca8c005b44ed5c311af614
data/CHANGELOG.md CHANGED
@@ -6,6 +6,297 @@ notes come from the section below whose heading starts with `## [<version>]`.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.0] - 2026-11-15
10
+
11
+ ### Added
12
+
13
+ - `Nukadoko.run_command` takes `input:`, the TypeScript engine's name for
14
+ `stdin:`, and `redact:`, the secrets a step holds itself, written as
15
+ `{{secret.NAME}}` in the record while the program gets the real value.
16
+ - Env files and secrets, as the TypeScript engine reads them:
17
+ `Nukadoko.config(envFiles: [...])` and an environment's own `envFiles:`
18
+ fill the `env` fixture, with the same parser; a file git does not track,
19
+ or one that differs from HEAD, is a secret source whose values are
20
+ written as `{{secret.NAME}}` in step records, `http.jsonl`, the process
21
+ output files, and what `nuka do` prints, and what a step prints goes to
22
+ stderr with them redacted; `secrets: { public:, redact: }`
23
+ adjusts one key. `nuka check` reports `env-file-missing`,
24
+ `environment-env-file-missing`, `env-file-skipped-line`,
25
+ `secrets-public-key-unknown`, `secrets-redact-key-unknown`,
26
+ `secrets-redact-key-too-short`, and `tracked-secret-looking-key`, and an
27
+ env file that cannot be read stops a command with `env-file-unreadable`.
28
+ - `scratch.copy(source)` gives a step a fresh scratch directory that holds
29
+ a copy of a file or directory of the project, as the TypeScript engine's
30
+ does. A missing source raises before any directory is made.
31
+ - A step body that names no `args:` keyword (`def run(scratch:)`) is called
32
+ without them, as a TypeScript step that does not read its args; it used
33
+ to fail with `unknown keyword: :args`.
34
+ - `nuka run` takes targets: feature files, `file:line` selections (a
35
+ Scenario line or an Examples row), and directories, walked for `.feature`
36
+ files. With none it runs `features/`. A file named twice runs once.
37
+ - `nuka run --tag <expression>`, repeatable: `@name` or `not @name`, read
38
+ on the scenario, its Feature line, and its Examples block.
39
+ - `nuka run --env <name>`, repeatable. Without it a run starts
40
+ `defaultEnvironments`, else every environment that declares
41
+ `conditions`, else `default`.
42
+ - The `--json` envelope of `nuka run` has `selection` (`full` or
43
+ `partial`) and, under `--tag`, `tag_selection`.
44
+ - Refusals with the TypeScript engine's codes and exit 2:
45
+ `target-not-found`, `line-on-directory`, `markdown-target`,
46
+ `no-feature-files`, `no-scenario-at-line`, `unknown-environment`,
47
+ `invalid-value` (an expression other than `@name` or `not @name`, or
48
+ `--tag` beside a line target), `invalid-arguments` (an unknown flag),
49
+ and `check-errors`. A `--tag` that keeps no scenario fails with
50
+ `nothing-selected` and exit 1.
51
+ - `nuka run` writes `run.json` into the run directory, the `--json`
52
+ envelope as a file, in the TypeScript engine's shape: the commit and
53
+ working tree the run judged, the environments, `counts`, each
54
+ scenario execution with its steps (`step_record_id`, `observed`,
55
+ `error` with its `kind`, `used`, and each claim with `actual_from`,
56
+ `expected_from`, `expected_text`, and `outcome`), and the verdict table
57
+ with each row's `reason`. A failed scenario is a `scenario-failed`
58
+ finding with the `nuka run` line that runs it again.
59
+ - `nuka verdict [--json]`: whether the newest run that ended judged the
60
+ working tree as it is now and left nothing red, from run.json and one
61
+ git tree id, without starting a run. It fails with `run-missing`,
62
+ `run-stale`, `run-partial`, the run's own failed findings, or
63
+ `run-failed`, and notes `working-tree-unknown` and `run-without-base`.
64
+ The tree id is the one the TypeScript engine computes, so either engine's
65
+ verdict reads the other's run.
66
+ - `nuka run` writes `summary.md` beside `run.json`, rendered from it alone
67
+ in the TypeScript engine's words: the verdict table, each red row's
68
+ reason and where it stopped, what the run does not show (a criterion
69
+ `--env` left out, a skipped check, a held row no control proved, a
70
+ scenario with no claim on a Then line), the conditions, each claim, the
71
+ findings, and the commands that rerun a failed scenario. A scenario with
72
+ no claim on a Then line has `judged_by: "nothing"` in run.json.
73
+ - `nuka report [run] --format markdown [--out <file>] [--json]` renders a
74
+ run directory's summary again from its run.json, the newest run when none
75
+ is named.
76
+ - `nuka clean [--dry-run] [--json]` removes the run directories and the
77
+ directories an earlier release left under `.nukadoko/`.
78
+ - A scenario whose conditions hold in no environment of the run is left
79
+ out and counted in `table.left_out`. When `--env` leaves out every
80
+ selected scenario, the run fails with `nothing-selected` and names a run
81
+ that meets them.
82
+ - `nuka run --base <ref>` judges each criterion against the commit `ref`
83
+ names. A criterion is new, changed, unchanged (with `renamed_from` or
84
+ `retagged` when its name or its other tags moved), or removed. A new or
85
+ changed one runs at the base too, the ref's code with head's
86
+ `features/`, where a Then failing in each proof run makes it `proven`
87
+ and anything else `unproven`. An unchanged one runs in the old world,
88
+ head's working tree with the ref's `features/` and config, when the
89
+ mapping under it changed (a file under `features/` other than a
90
+ `.feature`, the config file, or the program file's `conditions` or
91
+ `defaultEnvironments`) or it was renamed or retagged, and is `moved` when
92
+ it does not pass there. Both trees are made under the run directory and
93
+ removed when it ends. `unproven` and `moved` rows are
94
+ `criterion-unproven` and `criterion-moved` findings, run.json's table
95
+ has `base`, `mapping_changed`, and `mapping_changes`, and summary.md
96
+ says what the run compared with and quotes each removed criterion. A ref
97
+ outside git or one that names no commit is refused with
98
+ `base-outside-git`, `base-shallow`, or `base-ref-unknown`.
99
+ - `nuka do <step> [--args <json>] [--use <step-id>]...` runs one step
100
+ outside any scenario, in one environment, and writes its step record to
101
+ `.nukadoko/do/<id>/record.json` and stdout, in the TypeScript engine's
102
+ shape. `--use` fills the step's `from` args from an earlier record, of
103
+ a `do` or of a run. A step it does not know is `unknown-step`, args that
104
+ are not a JSON object or do not fit the contract are `step-args-invalid`,
105
+ and a `--use` that names no record is `step-inputs-invalid`.
106
+ - `nuka scaffold <name> --pattern <p> [--then] [--description <text>]
107
+ [--replace]` writes a step file whose body raises `not implemented:
108
+ <name>` until it is written, and `nuka scaffold --feature <path>` writes
109
+ one for each line no step matches, its pattern read by
110
+ cucumber-expressions' generator and its name made from the pattern's
111
+ words, in the TypeScript engine's words: the same notes, the same
112
+ commands that write each stub again, and the same refusals
113
+ (`file-exists`, `file-edited`, `invalid-value`, `target-not-found`).
114
+ `--command`, `--request`, and `--from` are refused as not here yet.
115
+ - `nuka init` writes `nukadoko.config.rb`, the empty `features/steps/`,
116
+ and the `.gitignore` entries the TypeScript engine writes, refuses with
117
+ `config-exists` when the config file is there, and ends with a
118
+ self-check that loads the config and the steps.
119
+ - `nuka check` reports `features-dir-missing` when there is no
120
+ `features/`, and `no-step-files-found` when it holds no step file.
121
+ - `nuka check` reports more of the TypeScript engine's findings, in its
122
+ words: a pattern that cannot be read (`unnamed-capture`,
123
+ `unterminated-capture`, `invalid-capture-key`, `duplicate-capture-key`,
124
+ `unknown-parameter-type`, `pattern-syntax-error`),
125
+ `capture-type-mismatch`, `duplicate-pattern`, `then-without-claims`,
126
+ `claims-outside-then`, `condition-tag-malformed`, `condition-unknown`,
127
+ `expects-tag-malformed`, `outline-rows-share-name`, and the vocabulary
128
+ half of `scenario-without-then`. A whole-project check adds the notes
129
+ `pattern-unbound` and `step-description-todo`.
130
+ - `nuka check` reports a `from` key whose producer did not run earlier in
131
+ the scenario, or two producers that both did (`from-order-violation`,
132
+ held behind `from-order-check-suppressed` while an earlier line matches
133
+ no step), a table or docstring that fills no single key or a key of the
134
+ wrong type (`table-docstring-key-mismatch`), `fixture-cycle`,
135
+ `fixture-scope-violation`, `condition-unmet`, `outline-does-not-run`,
136
+ and `feature-parse-error`. A whole-project check adds the notes
137
+ `fixture-unused` and `from-unused`. `unfillable-required-key` and
138
+ `undefined-step-check-suppressed` now say what the TypeScript engine
139
+ says.
140
+ - `nuka run --order file|shuffled|shuffled:<seed>` plays the feature files,
141
+ then each file's scenarios, in the order the seed names, by the
142
+ TypeScript engine's key, so a seed names one order in either engine. A
143
+ shuffled run prints its seed, writes `order` into run.json, says it in
144
+ summary.md, and names what ran before a failed scenario in its rerun line.
145
+ - `nuka run --repeat <n>` plays the selection n times and prints a
146
+ `repeat` line for each scenario that failed at least once.
147
+ `--proof-runs <n>` sets how many runs prove a control, and `--records`
148
+ writes each scenario record to stdout as it ends. A value none of them
149
+ can read is `invalid-value`.
150
+ - `nuka run --concurrency <n>` hands whole feature files to n worker
151
+ processes, round robin in the run's order, and runs a file whose
152
+ Feature line has `@nukadoko:serial` after them, alone. A worker that
153
+ ends without a record for a file it was given makes the run
154
+ `run-incomplete`. `nuka check` reports `serial-tag-on-scenario`.
155
+ - A program file's `env` is the `env` fixture, and `requireEnv` reads one
156
+ of its keys.
157
+
158
+ ### Changed
159
+
160
+ - A step with no `returns` keeps nothing of what `run` gives back, so a
161
+ body that ends on a call (`register.set_discount(10)`) passes instead of
162
+ failing inside the engine; a Hash with keys fails with the TypeScript
163
+ engine's message, which names the keys the record would lose. A returns
164
+ failure now reads `returns validation failed:`, as there.
165
+ - `nuka check` lists errors, then warnings, then notes, as the TypeScript
166
+ engine does, and `undefined-step` names the patterned steps no line
167
+ binds, so a renamed sentence points at the step it was meant for.
168
+ - `nuka init` ends with `next:` naming the gem's `llms.txt`, as the
169
+ TypeScript engine names the package's, and `nuka --help` says its Ruby
170
+ section is how a Ruby step is written.
171
+ - `nuka check`'s `undefined-step` reads "No step definition matches" and
172
+ names `nuka scaffold --feature <file>` as its `do:`, as the TypeScript
173
+ engine does, and a project whose every line is undefined no longer also
174
+ gets `no-step-files-found`.
175
+ - `nuka init` adds a `scenarios` task that runs `bundle exec nuka run` to
176
+ a Rakefile that has none, and the config file it writes points at the
177
+ spec online, since the gem ships no `docs/`.
178
+ - `nuka --help` lists the commands by what they are for (Everyday,
179
+ Exploring, Upkeep), as the TypeScript engine does, and `--version`
180
+ prints the version. A command nuka does not have is refused, pointing at
181
+ `nuka --help`.
182
+ - A step definition `nuka check` refuses is named by the step's class
183
+ (`CountMatches claims[0] ...`) instead of `defineStep`, which a Ruby
184
+ step does not have.
185
+ - `nuka scaffold` takes `--command [<entry point>]`, `--cwd`, `--argv`,
186
+ `--request "<METHOD> <path>"`, `--body`, and `--from <step>.<key>`, as
187
+ the TypeScript engine does, instead of refusing them. A `--command` step
188
+ runs the program under Ruby in a scratch directory; a `--request` step
189
+ sends through the `request` fixture; a `--then --from` step with one
190
+ capture gets a whole claim. `--replace` knows each of these stubs again.
191
+ - `nuka run` prints its progress on stderr as the TypeScript engine does:
192
+ a `scenario i/n` line for each scenario, a `step i/n` line with its
193
+ status and time for each step, a failed step's first error line, the
194
+ producer it used, and its record, then the `steps` line, the counts,
195
+ the control runs, and the criteria. `--json` prints none of it.
196
+ - A Then step whose `observe` raises records `unobserved` with each
197
+ claim's `outcome: "unobserved"`, as the TypeScript engine does, instead
198
+ of a `step_error`.
199
+ - The `--json` envelope opens with `schema_version` and no longer has
200
+ `engine`, so both engines print the same fields.
201
+ - `nuka run` checks only the scenarios it selected, as the TypeScript
202
+ engine does, and a run stopped by `check` exits 2 with `check-errors`.
203
+ - Each refusal and each `nothing-selected` finding carries the TypeScript
204
+ engine's message, `fix`, and `do` line. `lib/nukadoko/codes.json` holds
205
+ the TypeScript engine's code registry, and `bin/sync-codes` writes it
206
+ from `nuka check --codes --json`. The text output prints `-` for a
207
+ finding with no place, and each `fix:` line.
208
+ - `nuka run --no-check` reports no finding of the check.
209
+ - A line no step matches fails with the TypeScript engine's message, `No
210
+ step definition matches "<text>"`.
211
+ - A program file whose `environments` declare no `conditions` and that has
212
+ no `defaultEnvironments` runs `default` alone, as the TypeScript engine
213
+ does, rather than every environment.
214
+ - A cell's `conditions` in run.json hold only the conditions the row's tags
215
+ name, each with the value the environment declares or `null`, as the
216
+ TypeScript engine writes them.
217
+ - Each step record.json `nuka run` writes is in the TypeScript engine's
218
+ shape: `schema_version`, `kind`, `args_origin`, `returns_dropped`,
219
+ the environment, world, run, and scenario it ran in, `evidence`, and
220
+ `observed`. A process `run_command` started is kept with its `group`,
221
+ the `files` it changed under its working directory, its `env`, and its
222
+ stdout and stderr as `process-<n>.stdout.txt` and
223
+ `process-<n>.stderr.txt`, and `run_command` returns `signal` and
224
+ `files` too. What a step changed in a scratch directory is
225
+ `observed.files`, and each claim names the channel its value was
226
+ measured in (`measured`, `expected_measured`). A claim read through a
227
+ view says so in `actual_from` (`as text`). http.jsonl keeps each
228
+ request with its `via`, `duration_ms`, and bodies as text with their
229
+ size, and a page's own requests are not counted as the step's.
230
+ - A claim on a literal names the pattern words that state it
231
+ (`literal:accepted`), and a step record lists the project fixtures its
232
+ step used, built (`setup_ms`, `at`) or `reused`.
233
+ - Each step gets a W3C trace id, as in the TypeScript engine. A request
234
+ the `request` fixture sends to the world carries a `traceparent`
235
+ (http.jsonl names it, with `declared_url`), and a process
236
+ `run_command` starts gets `TRACEPARENT`. The lines of program.log that
237
+ carry the step's trace id go to `program-log.txt` beside its record
238
+ (`observed.program_log`), and lines that came later to
239
+ `program-log-late.txt`. run.json's `worlds` names each world the run
240
+ started: its URL, commands, timings, log, and what the log held. A
241
+ served world's URL is `http://localhost:<port>`.
242
+ - A claim on `each` item is recorded with its declarations, how many
243
+ items there were and were selected, and each judged item, and a claim
244
+ step's failure message is the TypeScript engine's: one line per claim
245
+ that broke, with where two values part under `equal` and
246
+ `has-same-items`, and the item a broken `each` names. The run summary
247
+ writes each claim the same way, and names the record a value was
248
+ measured in when it is another step's.
249
+ - A polled claim step's record keeps each reading (`readings`), how many
250
+ there were (`attempts`), and its `settled` conditions with the reading
251
+ it stopped on, and its failure says why the poll stopped. A call a part
252
+ made is recorded as the TypeScript engine records it: `step`, `args`,
253
+ `result` or `error` with its kind, and its times. A step with a page
254
+ lists the Playwright calls it made (`actions`), read from its
255
+ trace.zip, and names the trace in `evidence`. run.json names the steps
256
+ a step used only when it failed.
257
+ - A page's documents, fetches, and XMLHttpRequests to the world carry the
258
+ step's traceparent, set through the Chrome DevTools Protocol. A claim
259
+ step that reads a page records what the page had received by the
260
+ judged reading (`pages`, `page_requests`) and what it showed right
261
+ after it (`judged_view`: its title, `judged/page.png`, and
262
+ `judged/page.aria.yml`).
263
+ - A request a step sends through Net::HTTP itself is recorded in its
264
+ http.jsonl with `via: "net/http"` and carries the step's traceparent,
265
+ so a claim on what it returned names the channel it was measured in.
266
+ A claim's `measured` reads the value at its `at` path, and a claim
267
+ whose expected value comes from `from` keeps `expected_text: null`.
268
+ - Claims are judged with the TypeScript engine's compares: `has-fields`,
269
+ `lacks-field`, `fits-text` (with `...`, `[..]`, and `[..:name]`), and
270
+ `is-a` (with its kinds) are judged now, and a claim whose two sides are
271
+ of two JSON types, or whose expected value every actual holds, breaks
272
+ with the TypeScript engine's `reason`. A claim nothing judged, such as a
273
+ `matches` pattern that ran out of time, is `unjudged`. A broken claim's
274
+ line names the field that does not fit, the field that is present, or
275
+ the line where a text stopped fitting. `nuka check` reports
276
+ `claim-kind-unknown`.
277
+ - The gem ships the signature of the whole engine, written by rbs-inline
278
+ from `lib/`'s comments into `sig/generated`, and CI checks `lib/` with
279
+ Steep. A step author's Steep reads the same `Step`, `Schema`, and fixture
280
+ types as before, now from that signature, and `run_command` declares
281
+ `timeout:` and `files:` too.
282
+ - `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.
283
+ - `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.
284
+ - 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.
285
+ - 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.
286
+ - `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.
287
+ - A claim on an each item with no actual reads the item itself, and a record keeps an actual value of null.
288
+ - `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.
289
+ - 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.
290
+ - `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.
291
+ - `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.
292
+ - 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`.
293
+ - `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.
294
+ - `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.
295
+ - `nuka skill path` prints the directory that holds the agent skills, which the gem now ships with `llms.txt`, as the npm package does.
296
+ - A control's proof runs come after every scenario of the pass has run
297
+ once, as in the TypeScript engine, rather than right after the control's
298
+ first run.
299
+
9
300
  ## [0.1.0] - 2026-11-14
10
301
 
11
302
  ### 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
- `conformance/` の 10 のケースを通します。
8
+ 状態: `conformance/engine/` のすべてのシナリオを通します。
9
+ これらのシナリオは、`nuka` の各コマンドを両方のエンジンに対して実行します。
10
+ `conformance/` の 10 のケースも通します。
10
11
  HTTP のステップ、ブラウザのステップ、コマンドラインのステップ、プロジェクトが定義するフィクスチャ、parts でできたステップ、poll する Then ステップ、`from`、docstring、Scenario Outline、条件つきの環境、control と proof run、判定表です。
11
- `--base`、`nuka check` の指摘の多くなど、TypeScript 版の機能の多くはまだありません。
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,14 +50,60 @@ 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]` は、プログラムを起動してすべてのシナリオを実行し、ステップごとの記録を `.nukadoko/runs/` に書きます。
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` フィクスチャに読み込みます。`nukadoko.program.rb` の環境は、その後ろに自分の `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
 
@@ -69,3 +118,7 @@ Nukadoko.program serve: { command: "bin/rails server -p {port}", ready: "/up" }
69
118
  - このディレクトリで `bundle install` を実行します。
70
119
  - `bundle exec ruby ../conformance/run-rb.rb` で、すべての検査ケースをこのエンジンで走らせます。
71
120
  - `bundle exec bin/test` で単体テストと、`test/hegel/` の Hegel の性質テストを走らせます。gem には Ruby 3.4 以上が要ります。
121
+ - `bundle exec rbs-inline --output=sig/generated lib` で、`lib/` の `#:` と `# @rbs` のコメントから型の定義を書き出します。
122
+ `bundle exec steep check` で、`lib/` をその定義で検査します。
123
+ rbs-inline が書き出したものはコミットします。
124
+ `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: an early core. It passes 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. Much of what the TypeScript engine does is not here yet, such as `--base`, and most of what `nuka check` reports.
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,14 +40,25 @@ 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 every scenario, and writes a record per step under `.nukadoko/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 in `nukadoko.program.rb` 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
 
@@ -62,5 +73,6 @@ Nukadoko.program serve: { command: "bin/rails server -p {port}", ready: "/up" }
62
73
  - `bundle install` in this directory.
63
74
  - `bundle exec ruby ../conformance/run-rb.rb` runs every conformance case under this engine.
64
75
  - `bundle exec bin/test` runs the unit tests and the Hegel property tests under `test/hegel/`. The gem needs Ruby 3.4 or later.
76
+ - `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
77
 
66
78
  [日本語](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