nukadoko 0.5.0 → 0.7.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 +553 -3
- data/README.ja.md +22 -6
- data/README.md +13 -7
- data/docs/ci.ja.md +542 -0
- data/docs/ci.md +635 -0
- data/docs/commands.ja.md +1524 -0
- data/docs/commands.md +1281 -0
- data/docs/engines.json +19 -0
- data/docs/execution-events.ja.md +336 -0
- data/docs/execution-events.md +423 -0
- data/docs/glossary.json +1348 -0
- data/docs/guide.ja.md +733 -0
- data/docs/guide.md +815 -0
- data/docs/intent.ja.md +133 -0
- data/docs/intent.md +156 -0
- data/docs/layout.ja.md +442 -0
- data/docs/layout.md +399 -0
- data/docs/releasing.ja.md +186 -0
- data/docs/releasing.md +237 -0
- data/docs/ruby/reference.ja.md +302 -0
- data/docs/ruby/reference.md +368 -0
- data/docs/spec.ja.md +8916 -0
- data/docs/spec.md +11250 -0
- data/docs/tutorial.ja.md +451 -0
- data/docs/tutorial.md +458 -0
- data/docs/typescript/adopting.ja.md +231 -0
- data/docs/typescript/adopting.md +251 -0
- data/docs/typescript/doors.ja.md +301 -0
- data/docs/typescript/doors.md +329 -0
- data/docs/typescript/migration-playwright-test.ja.md +189 -0
- data/docs/typescript/migration-playwright-test.md +212 -0
- data/docs/typescript/migration.ja.md +391 -0
- data/docs/typescript/migration.md +505 -0
- data/docs/typescript/reference.ja.md +176 -0
- data/docs/typescript/reference.md +197 -0
- data/docs/typescript/upgrading.ja.md +1774 -0
- data/docs/typescript/upgrading.md +2224 -0
- data/docs/web-app.ja.md +627 -0
- data/docs/web-app.md +659 -0
- data/docs/writing-scenarios.ja.md +544 -0
- data/docs/writing-scenarios.md +563 -0
- data/lib/nukadoko/base.rb +12 -5
- data/lib/nukadoko/changed_files.rb +95 -0
- data/lib/nukadoko/check.rb +459 -51
- data/lib/nukadoko/claim_drops.rb +271 -0
- data/lib/nukadoko/claim_line.rb +24 -4
- data/lib/nukadoko/claim_rules.rb +143 -1
- data/lib/nukadoko/claim_sides.rb +157 -9
- data/lib/nukadoko/cli.rb +403 -50
- data/lib/nukadoko/codes.json +246 -21
- data/lib/nukadoko/codes.rb +21 -4
- data/lib/nukadoko/command.rb +120 -13
- data/lib/nukadoko/command_help.rb +128 -0
- data/lib/nukadoko/compat.rb +469 -0
- data/lib/nukadoko/criteria.rb +1 -1
- data/lib/nukadoko/definition.rb +157 -7
- data/lib/nukadoko/error_frames.rb +6 -3
- data/lib/nukadoko/events/count.rb +146 -0
- data/lib/nukadoko/events/counted.rb +114 -0
- data/lib/nukadoko/events/format.rb +257 -0
- data/lib/nukadoko/events/lists.rb +154 -0
- data/lib/nukadoko/events/path.rb +285 -0
- data/lib/nukadoko/events/read.rb +284 -0
- data/lib/nukadoko/events/reader.rb +490 -0
- data/lib/nukadoko/events/selection.rb +252 -0
- data/lib/nukadoko/events/tally.rb +438 -0
- data/lib/nukadoko/features.rb +2 -2
- data/lib/nukadoko/fixtures.rb +160 -35
- data/lib/nukadoko/http_recording.rb +6 -2
- data/lib/nukadoko/intent.rb +364 -0
- data/lib/nukadoko/intent_file.rb +81 -0
- data/lib/nukadoko/intent_view.rb +190 -0
- data/lib/nukadoko/js_json.rb +2 -1
- data/lib/nukadoko/judge.rb +2 -2
- data/lib/nukadoko/judgment_file.rb +22 -1
- data/lib/nukadoko/judgments.rb +33 -3
- data/lib/nukadoko/measure_mcp.rb +202 -0
- data/lib/nukadoko/parts.rb +8 -2
- data/lib/nukadoko/path_view.rb +252 -0
- data/lib/nukadoko/place_rows.rb +161 -0
- data/lib/nukadoko/program.rb +1265 -51
- data/lib/nukadoko/program_log.rb +122 -0
- data/lib/nukadoko/program_shape.rb +385 -0
- data/lib/nukadoko/project_fixtures.rb +43 -10
- data/lib/nukadoko/project_program.rb +5 -4
- data/lib/nukadoko/repeated_prefix.rb +310 -0
- data/lib/nukadoko/report_run.rb +3 -3
- data/lib/nukadoko/run.rb +1156 -159
- data/lib/nukadoko/run_record.rb +70 -46
- data/lib/nukadoko/scaffold.rb +24 -6
- data/lib/nukadoko/schema.rb +15 -2
- data/lib/nukadoko/secrets.rb +55 -5
- data/lib/nukadoko/states.rb +478 -0
- data/lib/nukadoko/step.rb +71 -2
- data/lib/nukadoko/step_fixtures.rb +52 -3
- data/lib/nukadoko/summary.rb +803 -30
- data/lib/nukadoko/table.rb +4 -2
- data/lib/nukadoko/text_fit.rb +20 -7
- data/lib/nukadoko/trace.rb +152 -45
- data/lib/nukadoko/tree_passes.rb +95 -33
- data/lib/nukadoko/underneath.rb +311 -0
- data/lib/nukadoko/verdict.rb +18 -1
- data/lib/nukadoko/version.rb +1 -1
- data/lib/nukadoko/vocabulary.rb +166 -23
- data/lib/nukadoko/walk.rb +2 -2
- data/lib/nukadoko/walk_step.rb +1 -1
- data/lib/nukadoko.rb +23 -0
- data/llms.txt +42 -35
- data/sig/generated/nukadoko/base.rbs +4 -4
- data/sig/generated/nukadoko/changed_files.rbs +42 -0
- data/sig/generated/nukadoko/check.rbs +147 -10
- data/sig/generated/nukadoko/claim_drops.rbs +135 -0
- data/sig/generated/nukadoko/claim_line.rbs +11 -0
- data/sig/generated/nukadoko/claim_rules.rbs +49 -4
- data/sig/generated/nukadoko/claim_sides.rbs +63 -12
- data/sig/generated/nukadoko/cli.rbs +80 -7
- data/sig/generated/nukadoko/codes.rbs +19 -4
- data/sig/generated/nukadoko/command.rbs +68 -1
- data/sig/generated/nukadoko/command_help.rbs +18 -0
- data/sig/generated/nukadoko/compat.rbs +392 -0
- data/sig/generated/nukadoko/criteria.rbs +1 -1
- data/sig/generated/nukadoko/definition.rbs +50 -0
- data/sig/generated/nukadoko/error_frames.rbs +1 -1
- data/sig/generated/nukadoko/events/count.rbs +69 -0
- data/sig/generated/nukadoko/events/counted.rbs +70 -0
- data/sig/generated/nukadoko/events/format.rbs +163 -0
- data/sig/generated/nukadoko/events/lists.rbs +47 -0
- data/sig/generated/nukadoko/events/path.rbs +161 -0
- data/sig/generated/nukadoko/events/read.rbs +109 -0
- data/sig/generated/nukadoko/events/reader.rbs +226 -0
- data/sig/generated/nukadoko/events/selection.rbs +100 -0
- data/sig/generated/nukadoko/events/tally.rbs +227 -0
- data/sig/generated/nukadoko/features.rbs +6 -4
- data/sig/generated/nukadoko/fixtures.rbs +67 -11
- data/sig/generated/nukadoko/http_recording.rbs +1 -1
- data/sig/generated/nukadoko/intent.rbs +132 -0
- data/sig/generated/nukadoko/intent_file.rbs +46 -0
- data/sig/generated/nukadoko/intent_view.rbs +69 -0
- data/sig/generated/nukadoko/judgment_file.rbs +7 -1
- data/sig/generated/nukadoko/judgments.rbs +10 -0
- data/sig/generated/nukadoko/measure_mcp.rbs +104 -0
- data/sig/generated/nukadoko/parts.rbs +2 -2
- data/sig/generated/nukadoko/path_view.rbs +105 -0
- data/sig/generated/nukadoko/place_rows.rbs +43 -0
- data/sig/generated/nukadoko/program.rbs +627 -23
- data/sig/generated/nukadoko/program_log.rbs +67 -0
- data/sig/generated/nukadoko/program_shape.rbs +147 -0
- data/sig/generated/nukadoko/project_fixtures.rbs +16 -3
- data/sig/generated/nukadoko/project_program.rbs +2 -1
- data/sig/generated/nukadoko/repeated_prefix.rbs +172 -0
- data/sig/generated/nukadoko/report_run.rbs +1 -1
- data/sig/generated/nukadoko/run.rbs +286 -41
- data/sig/generated/nukadoko/run_record.rbs +20 -12
- data/sig/generated/nukadoko/scaffold.rbs +3 -0
- data/sig/generated/nukadoko/schema.rbs +5 -0
- data/sig/generated/nukadoko/secrets.rbs +26 -3
- data/sig/generated/nukadoko/states.rbs +214 -0
- data/sig/generated/nukadoko/step.rbs +58 -1
- data/sig/generated/nukadoko/step_fixtures.rbs +39 -0
- data/sig/generated/nukadoko/summary.rbs +256 -2
- data/sig/generated/nukadoko/table.rbs +3 -2
- data/sig/generated/nukadoko/trace.rbs +108 -33
- data/sig/generated/nukadoko/tree_passes.rbs +36 -8
- data/sig/generated/nukadoko/underneath.rbs +141 -0
- data/sig/generated/nukadoko/verdict.rbs +8 -0
- data/sig/generated/nukadoko/vocabulary.rbs +45 -6
- data/skills/nukadoko/SKILL.md +18 -18
- data/skills/nukadoko/references/checking-steps.md +16 -83
- data/skills/nukadoko/references/diagnosing.md +6 -6
- data/skills/nukadoko/references/done.md +22 -0
- data/skills/nukadoko/references/evidence.md +19 -6
- data/skills/nukadoko/references/exploring.md +22 -7
- data/skills/nukadoko/references/fixtures.md +12 -32
- data/skills/nukadoko/references/judgments.md +18 -0
- data/skills/nukadoko/references/maintenance.md +1 -1
- data/skills/nukadoko/references/merge-risk.md +1 -1
- data/skills/nukadoko/references/parts.md +46 -23
- data/skills/nukadoko/references/{perturbed-worlds.md → perturbed-systems.md} +30 -12
- data/skills/nukadoko/references/program.md +168 -169
- data/skills/nukadoko/references/reviewing.md +20 -20
- data/skills/nukadoko/references/ruby/checking-steps.md +106 -0
- data/skills/nukadoko/references/ruby/examples/cli.md +212 -0
- data/skills/nukadoko/references/ruby/fixtures.md +34 -0
- data/skills/nukadoko/references/ruby/program.md +112 -0
- data/skills/nukadoko/references/ruby/step-files.md +115 -0
- data/skills/nukadoko/references/running.md +34 -34
- data/skills/nukadoko/references/scenario-rules.md +7 -6
- data/skills/nukadoko/references/states.md +7 -1
- data/skills/nukadoko/references/step-files.md +41 -120
- data/skills/nukadoko/references/typescript/checking-steps.md +129 -0
- data/skills/nukadoko/references/{examples → typescript/examples}/cli.md +1 -1
- data/skills/nukadoko/references/{examples → typescript/examples}/http-api.md +6 -6
- data/skills/nukadoko/references/{examples → typescript/examples}/workflow.md +1 -1
- data/skills/nukadoko/references/typescript/fixtures.md +56 -0
- data/skills/nukadoko/references/typescript/program.md +111 -0
- data/skills/nukadoko/references/typescript/step-files.md +104 -0
- data/skills/nukadoko/references/verdicts.md +10 -10
- data/skills/nukadoko/references/writing-steps.md +67 -67
- data/skills/nukadoko/references/writing-the-feature.md +1 -1
- data/skills/nukadoko-verification/SKILL.md +13 -8
- metadata +103 -7
- data/skills/nukadoko/references/ruby.md +0 -80
data/docs/commands.md
ADDED
|
@@ -0,0 +1,1281 @@
|
|
|
1
|
+
# Commands
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Each engine installs one command, `nuka`. The commands and the flags are almost the same in both engines, and the launcher is different. Where one engine does a thing differently, this page says so.
|
|
6
|
+
|
|
7
|
+
In a Ruby project, run `nuka` through Bundler. `nuka init` adds a `scenarios` task to a Rakefile that does not have one, and that task runs `nuka run` through Bundler:
|
|
8
|
+
|
|
9
|
+
<!-- engine: ruby -->
|
|
10
|
+
```sh
|
|
11
|
+
bundle exec nuka check
|
|
12
|
+
rake scenarios
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
In a TypeScript project, run `nuka` through npx. `nuka init` adds a `test:scenarios` script to `package.json`, and that script runs `nuka run`:
|
|
16
|
+
|
|
17
|
+
<!-- engine: typescript -->
|
|
18
|
+
```sh
|
|
19
|
+
npx nuka check
|
|
20
|
+
npm run test:scenarios
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The rest of this page writes `nuka` without the launcher.
|
|
24
|
+
|
|
25
|
+
`nuka --help` lists every command. `nuka <command> --help` prints the usage of one command, what it is for, and each flag it reads. `nuka step` is the exception: its flags are in the table of [nuka step](#nuka-step), and only the TypeScript engine prints them, under `nuka step wait --help`.
|
|
26
|
+
|
|
27
|
+
A feature file holds scenarios in plain words. Each line of a scenario is a step, and a step file holds the code that does what the line says. A run does the steps of each scenario. It keeps a record of each step, the step record. It also writes a short report of the run, the run summary. [Intent](intent.md) says why nukadoko works this way.
|
|
28
|
+
|
|
29
|
+
An environment is one variant of the program under test, such as a server with a feature turned on. The config declares the environments, and [Environments](spec.md#environments) gives the rules. A control is a run of a scenario in an environment where the conditions of the scenario do not hold. A control never makes the run fail. When a Then fails in a control, the scenario can see the difference. [Verdicts](spec.md#verdicts) gives the rules.
|
|
30
|
+
|
|
31
|
+
When a command takes `--json`, it prints one JSON document on stdout, the envelope, and nothing on stderr. [The envelope](spec.md#the-envelope) gives its fields. The exit codes of all commands are in [Streams and exit codes](spec.md#streams-and-exit-codes).
|
|
32
|
+
|
|
33
|
+
If this is the first page you read, start from one of these pages:
|
|
34
|
+
|
|
35
|
+
- [Your first scenario](tutorial.md) starts in an empty directory and runs the whole loop to a green scenario.
|
|
36
|
+
- [Project layout](layout.md) lists the files of a project and says what to write in each file.
|
|
37
|
+
- [Writing scenarios and steps](writing-scenarios.md) shows how to write a feature file and the steps behind it.
|
|
38
|
+
- [Testing a web app](web-app.md) shows how to start the program under test and drive a server or a browser page.
|
|
39
|
+
|
|
40
|
+
The table follows the loop: set up a project, write steps, check them, run the scenarios, and read the result.
|
|
41
|
+
|
|
42
|
+
| Command | Use it when |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `nuka init` | You start nukadoko in a project. |
|
|
45
|
+
| `nuka scaffold` | A feature line has no step, or you want a new step file. |
|
|
46
|
+
| `nuka check` | You changed a feature file, a step, or the config, and you want to know what is wrong before anything runs. |
|
|
47
|
+
| `nuka run` | You want to run the scenarios and get step records and a run summary. |
|
|
48
|
+
| `nuka report` | You want a finished run again as Markdown, Allure results, or a cucumber-messages stream. |
|
|
49
|
+
| `nuka verdict` | You want to know if the newest run is still true for the files as they are now, or if you changed a file after it. |
|
|
50
|
+
| `nuka judge` | A Then line asks a person or an agent to judge a value, and you want to see the values or record the judgment. |
|
|
51
|
+
| `nuka steps` | You want the list of steps that exist before you write a feature line. |
|
|
52
|
+
| `nuka describe` | You want the full contract of one step. |
|
|
53
|
+
| `nuka do` | You want to try one step by itself, with no feature file and no scenario, and see its step record. |
|
|
54
|
+
| `nuka step` | A run that you started with [`nuka run --step`](#nuka-run) waits after each step, and you want to tell it to go on or to stop. |
|
|
55
|
+
| `nuka clean` | You want to remove old runs and exports from `.nukadoko/`, the directory where nukadoko keeps them. |
|
|
56
|
+
| `nuka skill` | You want the path of the agent skills that ship with this version. |
|
|
57
|
+
| `nuka sig` | (Ruby only) You use Steep and want the RBS types of each step. |
|
|
58
|
+
|
|
59
|
+
`nuka sig` is in the Ruby engine only.
|
|
60
|
+
|
|
61
|
+
## nuka init
|
|
62
|
+
|
|
63
|
+
### Synopsis
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
nuka init [--allure]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### What it does
|
|
70
|
+
|
|
71
|
+
`nuka init` sets up a project for nukadoko. It writes the config file, the empty `features/steps/` directory, and the `.gitignore` entries. It also adds a command that runs the scenarios: a Rake task or an npm script. Then it does the same check as `nuka check`. Its last stderr line names `llms.txt`. This file is in the installed package, and it tells an agent how to use nukadoko. When the config file already exists, `nuka init` refuses and writes nothing.
|
|
72
|
+
|
|
73
|
+
### Flags
|
|
74
|
+
|
|
75
|
+
| Flag | Meaning | Default |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `--allure` | Also write `allurerc.mjs` and an empty `.nukadoko/export/allure-results/` for `nuka report --format allure`. TypeScript only: the Ruby engine lists it in `--help` but refuses it with `invalid-arguments`. | off |
|
|
78
|
+
|
|
79
|
+
### Writes
|
|
80
|
+
|
|
81
|
+
- The config file: `nukadoko.config.rb` in Ruby. In TypeScript, `nukadoko.config.ts` when `package.json` has `"type": "module"`, and `nukadoko.config.mts` when it does not. With `.mts`, a note on stderr says to write the step files as `.mts` too.
|
|
82
|
+
- `features/steps/`, empty.
|
|
83
|
+
- `.gitignore`: the lines `.nukadoko/`, `.env`, `.env.*`, and `!.env.example`.
|
|
84
|
+
- Ruby: a `scenarios` task in `Rakefile`, when a Rakefile exists and has no such task. With no Rakefile, no Rakefile is written.
|
|
85
|
+
- TypeScript: a `test:scenarios` script in `package.json` unless one exists.
|
|
86
|
+
- TypeScript, when `tsconfig.json` exists: the steps and the config in its `include` when it leaves them out, and `"rewriteRelativeImportExtensions": true` in its `compilerOptions` when neither that option nor `allowImportingTsExtensions` is set in the file or in a file it extends. When `nuka init` changes `tsconfig.json`, stdout lists it too.
|
|
87
|
+
- With `--allure`: `allurerc.mjs` and `.nukadoko/export/allure-results/`.
|
|
88
|
+
|
|
89
|
+
### Exit codes
|
|
90
|
+
|
|
91
|
+
- `0`: the project is set up and the self-check passed.
|
|
92
|
+
- `1`: the self-check failed. In the TypeScript engine, a step file in `features/steps/` that does not import fails it with `step-file-import-failed`. The files are written first.
|
|
93
|
+
- `2`: refused, and nothing was written. For example, the config file exists (`config-exists`).
|
|
94
|
+
|
|
95
|
+
### Example
|
|
96
|
+
|
|
97
|
+
In a new TypeScript project whose `package.json` has `"type": "module"` (`npm pkg set type=module` sets it) and that has no `tsconfig.json`:
|
|
98
|
+
|
|
99
|
+
<!-- engine: typescript -->
|
|
100
|
+
```text
|
|
101
|
+
$ npx nuka init
|
|
102
|
+
nukadoko.config.ts
|
|
103
|
+
features/steps
|
|
104
|
+
.gitignore
|
|
105
|
+
package.json
|
|
106
|
+
next: read node_modules/nukadoko/llms.txt, written for an agent: the loop, every command, and every finding code
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
In a new Ruby project with a Gemfile and an empty Rakefile, stdout holds:
|
|
110
|
+
|
|
111
|
+
<!-- engine: ruby -->
|
|
112
|
+
```text
|
|
113
|
+
$ bundle exec nuka init
|
|
114
|
+
nukadoko.config.rb
|
|
115
|
+
features/steps
|
|
116
|
+
.gitignore
|
|
117
|
+
Rakefile
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
stdout holds the paths that `nuka init` wrote. The `next:` line is on stderr. In Ruby, it names the `llms.txt` of the installed gem.
|
|
121
|
+
|
|
122
|
+
### Common mistakes
|
|
123
|
+
|
|
124
|
+
- You run `nuka init` again in a project that has a config. It refuses with `config-exists`:
|
|
125
|
+
|
|
126
|
+
```text
|
|
127
|
+
refused config-exists - Refusing to init: /path/to/project/nukadoko.config.ts already exists; nothing was written
|
|
128
|
+
fix: Edit the config file that exists, or delete it to start again.
|
|
129
|
+
do: nuka check
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
- You pass `--allure` to the Ruby engine. It refuses with `invalid-arguments` and the message `--allure is not in the Ruby engine yet`.
|
|
133
|
+
- A step file in `features/steps/` has an import that does not resolve. In the TypeScript engine the self-check reports `step-file-import-failed` and exits 1. Correct the import, then run `nuka check`.
|
|
134
|
+
|
|
135
|
+
The full text: [CLI summary](spec.md#cli-summary).
|
|
136
|
+
|
|
137
|
+
## nuka scaffold
|
|
138
|
+
|
|
139
|
+
### Synopsis
|
|
140
|
+
|
|
141
|
+
```text
|
|
142
|
+
nuka scaffold <name> [--pattern <text>] [--then | --command [<entry point>] [--cwd <key>] [--argv <key>] | --request "<METHOD> <path>" [--body <key>]] [--from <step>.<key>]... [--description <text>] [--replace]
|
|
143
|
+
nuka scaffold --feature <path>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### What it does
|
|
147
|
+
|
|
148
|
+
`nuka scaffold` writes a typed step file. The step fails with "not implemented" until you write its body, so a stub never passes by accident. `--pattern` sets the line the step matches, and each `{key:type}` capture becomes an args field. `--then`, `--command`, `--request`, and `--from` write a complete step for common cases, so that no edit is necessary. `--feature` writes one stub for each line of a feature file that no step matches, with the pattern read from the line.
|
|
149
|
+
|
|
150
|
+
### Flags
|
|
151
|
+
|
|
152
|
+
The positional `<name>` is the step name in kebab-case. It becomes the file name: `features/steps/<name>.ts`, or `features/steps/<name>.rb` with dashes changed to underscores. Leave it out with `--feature`.
|
|
153
|
+
|
|
154
|
+
| Flag | Meaning | Default |
|
|
155
|
+
| --- | --- | --- |
|
|
156
|
+
| `--feature <path>` | A feature file or a directory of them. Write one stub for each line that `nuka check` reports as `undefined-step`. Give no name and no other flag with it: TypeScript refuses them with `invalid-arguments`, and Ruby ignores them. | none |
|
|
157
|
+
| `--pattern <text>` | The feature line text that the step matches. Each `{key:type}` capture becomes an args field. | none |
|
|
158
|
+
| `--then` | Write a claim step for a Then line: claims in place of a run, against a value the line states. | off |
|
|
159
|
+
| `--command [<entry point>]` | Write a When step that runs a program in a scratch directory and returns `exitCode`, `stdout`, and `stderr`. The entry point must be a file, relative to the directory `nuka` runs in, or an absolute path, which the step keeps as given. Without an entry point, the step holds a TODO and refuses to run. | none |
|
|
160
|
+
| `--cwd <key>` | With `--command`: run the program in the directory that this args key holds. | the scratch directory |
|
|
161
|
+
| `--argv <key>` | With `--command`: split this string capture into program arguments on whitespace. | none |
|
|
162
|
+
| `--request "<METHOD> <path>"` | Write a When step that sends one HTTP request and returns `status` and `body`. | none |
|
|
163
|
+
| `--body <key>` | With `--request`: send this args key as the request data. | none |
|
|
164
|
+
| `--from <step>.<key>` | Fill an args key from a value that an earlier step returns. Repeatable. With `--then` and one stated value, the claim compares the two. | none |
|
|
165
|
+
| `--description <text>` | The step's description. Without it, `--command` and `--request` write one, and other forms write a TODO that `nuka check` notes as `step-description-todo`. | a TODO |
|
|
166
|
+
| `--replace` | Overwrite the step file while it is still, byte for byte, what scaffold writes. Any other file is refused. | off |
|
|
167
|
+
|
|
168
|
+
### Writes
|
|
169
|
+
|
|
170
|
+
One step file in `features/steps/` for each step. With `--feature`, one file for each new pattern. stdout holds each path written. With `--feature`, stderr holds a `next:` line and, for each stub, the `nuka scaffold` command that writes it again with `--replace`. It can also hold `note:` lines. Lines of the same form in the same position (Given, When, or Then) share one stub. When a capture would also match a line that states a different value, the stub's pattern is the line as written, with no capture, and a note says so. A Then line that states no value gets no stub, and a note asks you to state the value in the line.
|
|
171
|
+
|
|
172
|
+
### Exit codes
|
|
173
|
+
|
|
174
|
+
- `0`: the step files are written.
|
|
175
|
+
- `2`: refused, and nothing was written. Examples: the file exists, a `--from` step does not return the key, or `--then` gets a line that states no value.
|
|
176
|
+
|
|
177
|
+
### Example
|
|
178
|
+
|
|
179
|
+
In the greet project, when only the `run-greet` step exists, scaffold the three Then lines from the feature file. This writes stubs with names from the lines. The [tutorial](tutorial.md#scaffold-the-steps) names its steps `exits-with`, `output-is`, and `error-says` instead, and the `nuka check` example below uses the tutorial's steps.
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
$ nuka scaffold --feature features/greet.feature
|
|
183
|
+
features/steps/it-exits-with.ts
|
|
184
|
+
features/steps/the-output-is.ts
|
|
185
|
+
features/steps/the-error-says.ts
|
|
186
|
+
next: redo a stub in place with its line below, adding --command, --request, --from, or --description; --replace overwrites the stub while nobody has edited it:
|
|
187
|
+
nuka scaffold it-exits-with --pattern 'it exits with {value:int}' --then --replace
|
|
188
|
+
nuka scaffold the-output-is --pattern 'the output is {value:string}' --then --replace
|
|
189
|
+
nuka scaffold the-error-says --pattern 'the error says {value:string}' --then --replace
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
The Ruby engine prints the same lines and writes `it_exits_with.rb`, `the_output_is.rb`, and `the_error_says.rb`. The tutorial uses `--command`, `--then`, and `--from` to write the complete greet steps.
|
|
193
|
+
|
|
194
|
+
### Common mistakes
|
|
195
|
+
|
|
196
|
+
- The step file exists. Scaffold refuses with `file-exists`. When scaffold wrote the file and nobody edited it, the `do:` line is the same command with `--replace`:
|
|
197
|
+
|
|
198
|
+
```text
|
|
199
|
+
refused file-exists - Refusing to scaffold: features/steps/run-greet.ts already exists, and it still holds what scaffold wrote
|
|
200
|
+
fix: Pass --replace if scaffold wrote the file and nobody edited it, or delete the file.
|
|
201
|
+
do: nuka scaffold run-greet --pattern 'I run greet with {name:string}' --command src/greet.ts --argv name --replace
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- `--from` names a key that the step does not return. Scaffold refuses with `step-inputs-invalid` and names the keys it does return. This is the TypeScript output; Ruby names `run_greet.rb` in the `fix:` line:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
refused step-inputs-invalid - Refusing to scaffold: run-greet does not return "status"; its keys are exitCode, stdout, stderr
|
|
208
|
+
fix: Add "status" to returns in features/steps/run-greet.ts and return status from its run().
|
|
209
|
+
do: nuka scaffold x --pattern 'it is {value:int}' --then --from run-greet.status
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
- `--then` gets a pattern with no capture and no word that states a value, such as `it is done`. Scaffold refuses with `invalid-value`. Capture the value in `--pattern`, such as `the count is {count:int}`.
|
|
213
|
+
|
|
214
|
+
The full text: [CLI summary](spec.md#cli-summary).
|
|
215
|
+
|
|
216
|
+
## nuka check
|
|
217
|
+
|
|
218
|
+
### Synopsis
|
|
219
|
+
|
|
220
|
+
```text
|
|
221
|
+
nuka check [<feature|dir>...] [--json] [--fail-on <code>]... [--env <name>]...
|
|
222
|
+
nuka check --codes [--json]
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### What it does
|
|
226
|
+
|
|
227
|
+
`nuka check` reads the feature files, the step files, and the config, and runs nothing. It reports each problem that it can find before a run. For example, a line that no step matches, or a line that two steps match. Each finding has a severity (`error`, `warning`, or `note`), a code, a place, a message, and a `fix:` or `do:` line. With no target, it checks every feature under the features directory and adds notes, such as a step that no feature line uses. `nuka run` does the same check before it runs. [Checks and notes](spec.md#checks-and-notes) has the rules.
|
|
228
|
+
|
|
229
|
+
### Flags
|
|
230
|
+
|
|
231
|
+
The positional targets are feature files or directories, selected as `nuka run` selects them. A `:line` suffix is refused, because check reads whole files.
|
|
232
|
+
|
|
233
|
+
| Flag | Meaning | Default |
|
|
234
|
+
| --- | --- | --- |
|
|
235
|
+
| `--json` | Print the envelope with `findings` and `fail_on_hits`. | off |
|
|
236
|
+
| `--fail-on <code>` | Exit 1 when a finding with this code is reported. The finding keeps its severity. Repeatable, or comma-separated. | none |
|
|
237
|
+
| `--codes` | List every finding code with a one-line description, instead of checking the project. | off |
|
|
238
|
+
| `--env <name>` | Check as a `nuka run` with the same `--env` flags runs. Repeatable. | every environment that declares conditions, or `default` |
|
|
239
|
+
|
|
240
|
+
To see every code, run `nuka check --codes`.
|
|
241
|
+
|
|
242
|
+
### Writes
|
|
243
|
+
|
|
244
|
+
Nothing.
|
|
245
|
+
|
|
246
|
+
### Exit codes
|
|
247
|
+
|
|
248
|
+
- `0`: no error. Warnings and notes do not change the exit code.
|
|
249
|
+
- `1`: at least one error, or a finding whose code `--fail-on` names.
|
|
250
|
+
- `2`: refused. Examples: a `:line` target, an unknown `--fail-on` code. In TypeScript, a config that does not load is refused with `config-invalid`. In Ruby, a config file that raises an error stops the command with a Ruby backtrace and exit 1.
|
|
251
|
+
|
|
252
|
+
### Example
|
|
253
|
+
|
|
254
|
+
In the greet project of the tutorial, the steps are complete, and the check finds no error. In TypeScript, a check with a target prints:
|
|
255
|
+
|
|
256
|
+
<!-- engine: typescript -->
|
|
257
|
+
```text
|
|
258
|
+
$ npx nuka check features/greet.feature
|
|
259
|
+
ok: no issues found
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
In Ruby, the same check also prints a `schema-field-undescribed` note for each step whose fields have no description, and exits 0.
|
|
263
|
+
|
|
264
|
+
Without a target, the check also reports notes in both engines. The greet steps still have the descriptions that scaffold wrote, so `--fail-on` can make those notes fail the check:
|
|
265
|
+
|
|
266
|
+
<!-- engine: typescript -->
|
|
267
|
+
```text
|
|
268
|
+
$ npx nuka check --fail-on step-description-todo
|
|
269
|
+
note step-description-todo features/steps/error-says.ts Step "error-says" still has the description nuka scaffold wrote ("TODO: describe error-says"); nuka steps and nuka describe show it to whoever picks a step, so say what the step does.
|
|
270
|
+
fix: Replace the description with one sentence that says what the step does.
|
|
271
|
+
...
|
|
272
|
+
fail-on: step-description-todo reported 3 findings
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
The `...` stands for the other notes. The command exits 1. The `fail-on:` line is on stderr. The Ruby engine prints the same `step-description-todo` notes with `.rb` file names, and its `schema-field-undescribed` notes have a different text.
|
|
276
|
+
|
|
277
|
+
### Common mistakes
|
|
278
|
+
|
|
279
|
+
These examples use the tally project of [Writing scenarios and steps](writing-scenarios.md): `run-tally` matches `I run tally with {argv:string}`, and `exits-with` takes `exitCode` from `run-tally`. Each finding names its code, the file (and the line when there is one), and a `fix:` or `do:` line. Each check exits 1.
|
|
280
|
+
|
|
281
|
+
The first two mistakes are in this `features/mistakes.feature`. The Then on line 5 reads the exit code before the program runs. The value on line 6 has no quotes. Line 7 runs the program in Then position:
|
|
282
|
+
|
|
283
|
+
```gherkin
|
|
284
|
+
Feature: three mistakes
|
|
285
|
+
|
|
286
|
+
Scenario: a file that cannot be read
|
|
287
|
+
Given an empty directory
|
|
288
|
+
Then it exits with 2
|
|
289
|
+
When I run tally with missing.csv
|
|
290
|
+
Then I run tally with "missing.csv"
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
- A value on a feature line has no quotes, such as line 6. No step matches the line, and check reports `undefined-step`. The TypeScript engine says where the quotes go:
|
|
294
|
+
|
|
295
|
+
<!-- engine: typescript -->
|
|
296
|
+
```text
|
|
297
|
+
error undefined-step features/mistakes.feature:6 No step definition matches "I run tally with missing.csv"; step "run-tally" with pattern "I run tally with {argv:string}" takes a quoted value at this position, as a {...:string} parameter
|
|
298
|
+
fix: Rewrite line 6 of features/mistakes.feature as: When I run tally with "missing.csv"
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
The Ruby text is different. It does not say where the quotes go, and it gives `do: nuka scaffold --feature features/mistakes.feature` in place of the `fix:` line.
|
|
302
|
+
|
|
303
|
+
- A Then line reads a value before the When line that makes it, such as line 5. The line that runs `run-tally` with a quoted value is line 7, after line 5. Check reports `from-order-violation`. Both engines print this text:
|
|
304
|
+
|
|
305
|
+
```text
|
|
306
|
+
error from-order-violation features/mistakes.feature:5 Step "exits-with"'s from.exitCode needs step "run-tally" to have already run earlier in this scenario, but "run-tally" is bound in this scenario, but only at or after this line, never before it. This line would fail args validation with certainty
|
|
307
|
+
fix: Put a line that runs step "run-tally" earlier in the scenario. Or, if a step that an earlier line runs returns exitCode, list that step as another [step, "exitCode"] candidate in from.exitCode of step "exits-with".
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Line 7 is a related mistake. It runs a program in Then position, so check also reports `then-without-claims` for it.
|
|
311
|
+
|
|
312
|
+
- A capture in a step's pattern has a name that is not an args key, such as `{argb:string}` where the key is `argv`. This mistake is in the step file `features/steps/run-tally.ts` (`run_tally.rb` in Ruby). Check reports `unknown-capture-key` on the step file. No capture fills `argv` now, so check also reports `unfillable-required-key` on each feature line that the step matches:
|
|
313
|
+
|
|
314
|
+
<!-- engine: typescript -->
|
|
315
|
+
```text
|
|
316
|
+
error unknown-capture-key features/steps/run-tally.ts Step "run-tally" pattern "I run tally with {argb:string}" binds key "argb", which is not a key of its args schema
|
|
317
|
+
fix: Rename the capture to a key of the args schema, or add the key to the schema.
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
The Ruby text is the same, but the place also gives the line of `run`: `features/steps/run_tally.rb:17`.
|
|
321
|
+
|
|
322
|
+
The full text: [CLI summary](spec.md#cli-summary).
|
|
323
|
+
|
|
324
|
+
## nuka run
|
|
325
|
+
|
|
326
|
+
### Synopsis
|
|
327
|
+
|
|
328
|
+
```text
|
|
329
|
+
nuka run [<feature[:line]|dir>...] [--no-check] [--env <name>]... [--tag <expression>]... [--order file|shuffled[:<seed>]] [--repeat <n>] [--concurrency <n>] [--proof-runs <n>] [--base <git ref>] [--step] [--records] [--json]
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### What it does
|
|
333
|
+
|
|
334
|
+
`nuka run` checks the selected scenarios first. An error stops the run before anything runs. Then `nuka run` starts the program under test for each environment. It runs each selected scenario and writes one step record for each step. stderr shows the progress, the paths that the run wrote, and a summary line. Each failed scenario gets a line with a `do:` command that runs it again. Every run writes `run.json` and a Markdown summary. [Verdicts](spec.md#verdicts) tells how the run decides each verdict, with the controls and the proof runs. [Environments](spec.md#environments) tells how to declare the environments.
|
|
335
|
+
|
|
336
|
+
### Flags
|
|
337
|
+
|
|
338
|
+
The positional targets are feature files, `file:line` for one scenario, or directories. With no target, the run uses the features directory. A `:line` on a directory is refused.
|
|
339
|
+
|
|
340
|
+
| Flag | Meaning | Default |
|
|
341
|
+
| --- | --- | --- |
|
|
342
|
+
| `--no-check` | Skip the check before the run, to run a scenario that check refuses. | the check runs |
|
|
343
|
+
| `--env <name>` | Run in this environment of the program. Repeat it to run each scenario once in each. | every environment that declares conditions, or `default` |
|
|
344
|
+
| `--tag <expression>` | Run only scenarios whose tags meet `@name` or `not @name`. Repeat it, and a scenario must meet every one. | all scenarios |
|
|
345
|
+
| `--order file\|shuffled[:<seed>]` | The order of the feature files and of each file's scenarios. `shuffled` draws a seed; `shuffled:<seed>` repeats an order. See [Order](spec.md#order). | `file` |
|
|
346
|
+
| `--repeat <n>` | Run every selected scenario n times in this run. | `1` |
|
|
347
|
+
| `--concurrency <n>` | Run n worker processes, one whole feature file each. A file tagged `@nukadoko:serial` runs alone. | `1` |
|
|
348
|
+
| `--proof-runs <n>` | How many times a control must break the same claim before it proves the scenario. | `2` |
|
|
349
|
+
| `--base <git ref>` | Compare each scenario with the commit that the ref names. New and changed scenarios also run against the base code. | none |
|
|
350
|
+
| `--step` | Pause after each step of one scenario until `nuka step` answers. See [A walk with a person](spec.md#a-walk-with-a-person). | off |
|
|
351
|
+
| `--records` | Print each scenario's `run.json` entry on stdout as one JSON line when the scenario ends. | stdout stays empty |
|
|
352
|
+
| `--json` | Print `run.json` on stdout as one document, and nothing on stderr. | off |
|
|
353
|
+
|
|
354
|
+
### Writes
|
|
355
|
+
|
|
356
|
+
- `.nukadoko/runs/<run_id>/`: `run.json`, `summary.md`, `sources.json`, and `steps/<step id>/record.json` with the files that each step captured.
|
|
357
|
+
- `systems/<environment>/<service>/` in the run directory when the config has a program, with each service's `program.log`. Ruby writes `systems/<environment>/` also when there is no program.
|
|
358
|
+
- With `--step`, a screenshot and an ARIA snapshot of each open page under `pauses/<n>/` of the run directory, and each answer of `nuka step` in `answers/<n>.json`.
|
|
359
|
+
- TypeScript: the summary is also appended to `$GITHUB_STEP_SUMMARY` when that variable is set.
|
|
360
|
+
|
|
361
|
+
A run writes no Allure results and no messages stream. [`nuka report`](#nuka-report) makes them from a finished run.
|
|
362
|
+
|
|
363
|
+
### Exit codes
|
|
364
|
+
|
|
365
|
+
- `0`: every selected scenario passed.
|
|
366
|
+
- `1`: a scenario failed, or `--tag` left out every scenario (`nothing-selected`). With `--base`, or with a control that does not prove its scenario, the run also exits 1 when a criterion is failed, unproven (`criterion-unproven`), or moved, even when every scenario passed.
|
|
367
|
+
- `2`: refused, and nothing ran. Examples: an error from the check (`check-errors`), a target that does not exist, an unknown environment, `--repeat 0`.
|
|
368
|
+
- `130`: the run stopped on SIGINT (Ctrl-C). Other signals give 128 plus the signal number.
|
|
369
|
+
|
|
370
|
+
### Example
|
|
371
|
+
|
|
372
|
+
```text
|
|
373
|
+
$ nuka run
|
|
374
|
+
scenario 1/2 features/greet.feature:3 greets by name
|
|
375
|
+
step 1/3 passed 0.1s I run greet with "Ada"
|
|
376
|
+
step 2/3 passed 0.0s it exits with 0
|
|
377
|
+
step 3/3 passed 0.0s the output is "Hello, Ada!"
|
|
378
|
+
scenario 2/2 features/greet.feature:8 no name is an error
|
|
379
|
+
step 1/3 passed 0.1s I run greet with ""
|
|
380
|
+
step 2/3 passed 0.0s it exits with 1
|
|
381
|
+
step 3/3 passed 0.0s the error says "greet: a name is required"
|
|
382
|
+
steps .nukadoko/runs/run-20261203-230449-c1v6/steps/ 6
|
|
383
|
+
summary .nukadoko/runs/run-20261203-230449-c1v6/summary.md
|
|
384
|
+
run .nukadoko/runs/run-20261203-230449-c1v6/run.json
|
|
385
|
+
2 scenarios: 2 passed, 0 failed (0s)
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
When `greet` prints `Hi, Ada!` in place of `Hello, Ada!`, the claim breaks, and the run exits 1 and ends with:
|
|
389
|
+
|
|
390
|
+
```text
|
|
391
|
+
failed scenario-failed features/greet.feature:3 greets by name: claim broken: "Hi, Ada!" (from:run-greet@4.stdout as text) equal "Hello, Ada!" (sentence:text)
|
|
392
|
+
do: nuka run features/greet.feature:3
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Common mistakes
|
|
396
|
+
|
|
397
|
+
- The check finds an error, such as an `undefined-step`. The run prints the finding, refuses with `check-errors`, and runs nothing. Correct the error, or pass `--no-check` to run anyway.
|
|
398
|
+
- You pass `--step` with a target that selects more than one scenario. The run refuses with `step-needs-one-scenario`, and its `do:` line names one scenario, such as `nuka run features/greet.feature:3 --step`.
|
|
399
|
+
- You put `:line` on a directory, such as `features:3`. The run refuses with `line-on-directory`.
|
|
400
|
+
|
|
401
|
+
The full text: [CLI summary](spec.md#cli-summary).
|
|
402
|
+
|
|
403
|
+
## nuka report
|
|
404
|
+
|
|
405
|
+
### Synopsis
|
|
406
|
+
|
|
407
|
+
```text
|
|
408
|
+
nuka report [<run dir>] --format markdown|allure|messages [--out <path>] [--json]
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### What it does
|
|
412
|
+
|
|
413
|
+
`nuka report` renders one finished run again from its run directory alone. It never runs a scenario. `markdown` is the run summary, `allure` is a directory of Allure results, and `messages` is a cucumber-messages NDJSON stream. A run directory copied from another machine, or written by the other engine, renders the same. [Allure results](spec.md#allure-results) and [Messages stream](spec.md#messages-stream) describe the two exports.
|
|
414
|
+
|
|
415
|
+
### Flags
|
|
416
|
+
|
|
417
|
+
The positional `<run dir>` is a run directory. Without it, the report uses the newest run under `.nukadoko/runs/`.
|
|
418
|
+
|
|
419
|
+
| Flag | Meaning | Default |
|
|
420
|
+
| --- | --- | --- |
|
|
421
|
+
| `--format markdown\|allure\|messages` | The output to render. Required. | none |
|
|
422
|
+
| `--out <path>` | A file for `markdown` and `messages`, a directory for `allure`. A missing directory on the way is created. | stdout for `markdown` and `messages`; `.nukadoko/export/allure-results/` for `allure` |
|
|
423
|
+
| `--json` | Print the envelope with `run_id`, `format`, and `written`. Needs `--out` for `markdown` and `messages`. | off |
|
|
424
|
+
|
|
425
|
+
### Writes
|
|
426
|
+
|
|
427
|
+
- `markdown` and `messages`: the `--out` file, or nothing (the output goes to stdout).
|
|
428
|
+
- `allure`: the result files in `.nukadoko/export/allure-results/`, or in the `--out` directory. A second render of the same run there replaces the first.
|
|
429
|
+
|
|
430
|
+
### Exit codes
|
|
431
|
+
|
|
432
|
+
- `0`: the run is rendered.
|
|
433
|
+
- `1`: an `allure` or `messages` render left out part of the run (`report-incomplete`), for example when a step record was removed from the run directory. `markdown` renders from `run.json` alone, so a removed step record does not change its exit code.
|
|
434
|
+
- `2`: refused. Examples: no `--format`, no run directory with a `run.json` (`run-not-found`), `--json` without `--out` for `markdown` or `messages`.
|
|
435
|
+
|
|
436
|
+
### Example
|
|
437
|
+
|
|
438
|
+
After `nuka run` in the greet project:
|
|
439
|
+
|
|
440
|
+
```text
|
|
441
|
+
$ nuka report --format allure
|
|
442
|
+
allure .nukadoko/export/allure-results/ 2
|
|
443
|
+
$ nuka report --format messages --out out/messages.ndjson --json
|
|
444
|
+
{
|
|
445
|
+
"schema_version": 4,
|
|
446
|
+
"nukadoko": "0.29.0",
|
|
447
|
+
"command": "report",
|
|
448
|
+
"verdict": "passed",
|
|
449
|
+
"findings": [],
|
|
450
|
+
"run_id": "run-20261203-230531-zmmd",
|
|
451
|
+
"format": "messages",
|
|
452
|
+
"written": [
|
|
453
|
+
"out/messages.ndjson"
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Common mistakes
|
|
459
|
+
|
|
460
|
+
- You leave out `--format`. The report refuses with `invalid-arguments` and the message `Missing required argument: format`.
|
|
461
|
+
- No run exists yet. The report refuses with `run-not-found`, and its `do:` line is `nuka run`:
|
|
462
|
+
|
|
463
|
+
```text
|
|
464
|
+
refused run-not-found - no run under .nukadoko/runs has a run.json
|
|
465
|
+
fix: Name a run directory that holds a run.json, or run nuka run first.
|
|
466
|
+
do: nuka run
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
- You pass `--json` with `--format markdown` or `--format messages` and no `--out`. The report refuses with `invalid-arguments`, because the output and the envelope cannot both go to stdout.
|
|
470
|
+
|
|
471
|
+
The full text: [CLI summary](spec.md#cli-summary).
|
|
472
|
+
|
|
473
|
+
## nuka verdict
|
|
474
|
+
|
|
475
|
+
### Synopsis
|
|
476
|
+
|
|
477
|
+
```text
|
|
478
|
+
nuka verdict [--json] [--trailer]
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### What it does
|
|
482
|
+
|
|
483
|
+
The working tree is the files of the project as they are now, with the changes that are not committed.
|
|
484
|
+
`nuka verdict` reads the newest run that ended and compares the files that the run checked with the working tree.
|
|
485
|
+
It prints `passed` when the run checked the working tree as it is now and no criterion failed.
|
|
486
|
+
It prints `failed` when no run ended (`run-missing`), when the files changed after the run (`run-stale`), when the run left out scenarios or was a walk with `nuka run --step` (`run-partial`), or when a criterion failed (`run-failed`).
|
|
487
|
+
Outside a git repository, or before the first commit, git gives no id for the working tree: the verdict then comes from the run alone, with the note `working-tree-unknown`.
|
|
488
|
+
It never starts a run: it reads `run.json` and asks git for the id of the working tree.
|
|
489
|
+
Use it before a commit or a push, to make sure that the last run still covers your current files.
|
|
490
|
+
|
|
491
|
+
### Flags
|
|
492
|
+
|
|
493
|
+
| Flag | Meaning | Default |
|
|
494
|
+
| --- | --- | --- |
|
|
495
|
+
| `--json` | Print the envelope on stdout. It adds `judged`, `working_tree`, `run_id`, `run_dir`, `run_working_tree`, `base`, and `trailer`. | `false` |
|
|
496
|
+
| `--trailer` | Print only one git trailer line, and exit 0 whatever it says. The word after `Nukadoko-Verdict:` is `passed`, `failed`, `stale`, `none`, or `unknown`. `none` (no run) stands alone. The other words add `run <run-id>`, and then `tree <id>` when the run recorded a tree. | `false` |
|
|
497
|
+
|
|
498
|
+
### Writes
|
|
499
|
+
|
|
500
|
+
Nothing.
|
|
501
|
+
|
|
502
|
+
### Exit codes
|
|
503
|
+
|
|
504
|
+
- `0`: the newest run checked the working tree as it is now, and no criterion failed. Outside git, or before the first commit, `0` means only that no criterion of the run failed (note `working-tree-unknown`). With `--trailer`, always 0.
|
|
505
|
+
- `1`: `run-missing`, `run-stale`, `run-partial`, or `run-failed`.
|
|
506
|
+
- `2`: the command line is wrong, for example an unknown flag (`invalid-arguments`).
|
|
507
|
+
|
|
508
|
+
### Example
|
|
509
|
+
|
|
510
|
+
On the greet project, after a full `nuka run`:
|
|
511
|
+
|
|
512
|
+
```sh
|
|
513
|
+
nuka verdict
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
```text
|
|
517
|
+
passed: the newest run, run-20261203-230843-lucw, judged this working tree and left nothing red
|
|
518
|
+
note run-without-base - the newest run run-20261203-230843-lucw had no --base, so no row says which criteria are new or changed, and a new one that passes without the change was not caught
|
|
519
|
+
fix: No change is necessary. Run with --base and the commit the change started from to have new and changed criteria proven against it.
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
The trailer line for the same run:
|
|
523
|
+
|
|
524
|
+
```sh
|
|
525
|
+
nuka verdict --trailer
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
```text
|
|
529
|
+
Nukadoko-Verdict: passed run run-20261203-230843-lucw tree ccec673062d6b84e927e5629fb1736cdffd226a6
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Common mistakes
|
|
533
|
+
|
|
534
|
+
- **A change after the run.** An edit to `src/greet.ts` after the run gives `run-stale`, and the exit is 1. Run `nuka run` again.
|
|
535
|
+
|
|
536
|
+
```text
|
|
537
|
+
failed: the newest run, run-20261203-230843-lucw, judged another working tree
|
|
538
|
+
failed run-stale - the newest run run-20261203-230843-lucw (started 2026-12-03T23:08:43.310Z) judged working tree ccec673062d6, and the working tree is now 080612fccf7b: its verdicts say nothing about what changed since
|
|
539
|
+
do: nuka run
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
- **A run of one scenario.** After `nuka run features/greet.feature:3`, the verdict is `run-partial`, because the run left out the other scenario of the file. Run the whole file or the whole project.
|
|
543
|
+
- **A walk as the newest run.** After `nuka run features/greet.feature:3 --step`, the verdict is `run-partial` too, even when every step passed: a walk explores a scenario, and it does not judge it. Run `nuka run` again.
|
|
544
|
+
|
|
545
|
+
The full text: [Records](spec.md#records) and the [CLI summary](spec.md#cli-summary).
|
|
546
|
+
|
|
547
|
+
## nuka judge
|
|
548
|
+
|
|
549
|
+
### Synopsis
|
|
550
|
+
|
|
551
|
+
```text
|
|
552
|
+
nuka judge <feature:line> [--run <run-id>] [--json]
|
|
553
|
+
nuka judge <feature:line> [--run <run-id>] --meets|--misses --by <name> --because <sentence> [--json]
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### What it does
|
|
557
|
+
|
|
558
|
+
Some Then steps ask for a judgment: a claim with the compare `judged-as`.
|
|
559
|
+
A run reads the value for such a claim, but it does not judge it.
|
|
560
|
+
`nuka judge` shows the values that a run read for one criterion: each value, the quality that the sentence names, the channel that holds the value, its digest, and its step record.
|
|
561
|
+
With `--meets` or `--misses`, `--by`, and `--because`, it records one judgment of each value in a judgment file, and the next run reads the criterion against that file.
|
|
562
|
+
It never runs a step.
|
|
563
|
+
|
|
564
|
+
The positional `<feature:line>` names the criterion: the feature file and the line of its `Scenario` keyword, not the line of the Then.
|
|
565
|
+
|
|
566
|
+
### Flags
|
|
567
|
+
|
|
568
|
+
| Flag | Meaning | Default |
|
|
569
|
+
| --- | --- | --- |
|
|
570
|
+
| `--run <run-id>` | The run whose records hold the values. | the newest run that ended |
|
|
571
|
+
| `--meets` | Record that each value meets the quality its sentence names. | `false` |
|
|
572
|
+
| `--misses` | Record that each value does not meet the quality. The criterion fails until the value changes. | `false` |
|
|
573
|
+
| `--by <name>` | Who judged, as they name themselves. Required with `--meets` or `--misses`. | none |
|
|
574
|
+
| `--because <sentence>` | Why the values meet or miss the sentence, in one sentence. Required with `--meets` or `--misses`. | none |
|
|
575
|
+
| `--json` | Print the envelope on stdout. | `false` |
|
|
576
|
+
|
|
577
|
+
### Writes
|
|
578
|
+
|
|
579
|
+
Without `--meets` or `--misses`: nothing.
|
|
580
|
+
With one of them: `judgments/<feature file>.json` at the project root, for example `judgments/features/greeting.feature.json`. Commit that file: its review records who judged.
|
|
581
|
+
|
|
582
|
+
### Exit codes
|
|
583
|
+
|
|
584
|
+
- `0`: it showed the values, or it recorded the judgment.
|
|
585
|
+
- `2`: it refused (`judgment-refused`), or the command line is wrong (`invalid-arguments`). It wrote nothing.
|
|
586
|
+
|
|
587
|
+
### Example
|
|
588
|
+
|
|
589
|
+
The greet project has no `judged-as` claim. This example is a copy of the project `conformance/engine/projects/judgments` of the repository. Its feature:
|
|
590
|
+
|
|
591
|
+
```gherkin
|
|
592
|
+
Feature: Greeting
|
|
593
|
+
|
|
594
|
+
Scenario: a first-time visitor is greeted
|
|
595
|
+
When I ask for the greeting
|
|
596
|
+
Then the greeting reads as "friendly to a first-time visitor"
|
|
597
|
+
|
|
598
|
+
Scenario: a cart total is shown
|
|
599
|
+
When a cart holds 3 items
|
|
600
|
+
Then the total reads as "a small number"
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
The When step `run-greet` runs a small program, `lib/greet.mjs`, that prints a fixed greeting:
|
|
604
|
+
|
|
605
|
+
```ruby
|
|
606
|
+
class RunGreet < Nukadoko::Step
|
|
607
|
+
pattern "I ask for the greeting"
|
|
608
|
+
description "Runs the greeting program"
|
|
609
|
+
returns do
|
|
610
|
+
string :stdout
|
|
611
|
+
number :exitCode, null: true
|
|
612
|
+
string :stderr
|
|
613
|
+
end
|
|
614
|
+
mutates false
|
|
615
|
+
|
|
616
|
+
def run(args:) = Nukadoko.run_command("node", [File.expand_path("lib/greet.mjs")])
|
|
617
|
+
end
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
```ts
|
|
621
|
+
import { defineStep, runCommand, z } from "nukadoko";
|
|
622
|
+
import { resolve } from "node:path";
|
|
623
|
+
|
|
624
|
+
export default defineStep({
|
|
625
|
+
pattern: "I ask for the greeting",
|
|
626
|
+
description: "Runs the greeting program",
|
|
627
|
+
args: z.object({}),
|
|
628
|
+
returns: z.object({ stdout: z.string(), exitCode: z.number().nullable(), stderr: z.string() }),
|
|
629
|
+
mutates: false,
|
|
630
|
+
async run() {
|
|
631
|
+
return await runCommand(process.execPath, [resolve("lib/greet.mjs")]);
|
|
632
|
+
},
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
The Then step takes the output of `run-greet` and asks for a judgment of it:
|
|
637
|
+
|
|
638
|
+
```ruby
|
|
639
|
+
class ReadsAs < Nukadoko::Step
|
|
640
|
+
pattern "the greeting reads as {quality:string}"
|
|
641
|
+
description "The greeting, for a reader to judge against the quality"
|
|
642
|
+
args do
|
|
643
|
+
string :quality, "What the greeting should read as"
|
|
644
|
+
field :stdout, RunGreet.returns[:stdout]
|
|
645
|
+
end
|
|
646
|
+
from stdout: [RunGreet, :stdout]
|
|
647
|
+
claims [{ actual: "stdout", view: "text", compare: "judged-as", expected: "quality" }]
|
|
648
|
+
end
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
```ts
|
|
652
|
+
import { defineStep, z } from "nukadoko";
|
|
653
|
+
import runGreet from "./run-greet.ts";
|
|
654
|
+
|
|
655
|
+
export default defineStep({
|
|
656
|
+
pattern: "the greeting reads as {quality:string}",
|
|
657
|
+
description: "The greeting, for a reader to judge against the quality",
|
|
658
|
+
args: z.object({ quality: z.string().describe("What the greeting should read as"), stdout: runGreet.returns.shape.stdout }),
|
|
659
|
+
from: { stdout: [runGreet, "stdout"] },
|
|
660
|
+
claims: [{ actual: "stdout", view: "text", compare: "judged-as", expected: "quality" }],
|
|
661
|
+
});
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
After `nuka run`, the run fails with `judgment-pending` and names the command. Show the value of the first scenario.
|
|
665
|
+
In the output, `from:run-greet@4.stdout` means: the `stdout` result of the step `run-greet`, which ran on line 4 of the feature.
|
|
666
|
+
|
|
667
|
+
```sh
|
|
668
|
+
nuka judge features/greeting.feature:3
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
```text
|
|
672
|
+
features/greeting.feature:3 "a first-time visitor is greeted" in run-20261203-234049-hhaj: 1 value to judge
|
|
673
|
+
- line 5 "the greeting reads as "friendly to a first-time visitor"", claim 0, in default: pending
|
|
674
|
+
quality: "friendly to a first-time visitor"
|
|
675
|
+
value, from:run-greet@4.stdout as text, measured observed.processes[0].stdout of step-20261203-234049-sf56:
|
|
676
|
+
Welcome! Make yourself at home.
|
|
677
|
+
digest: sha256:a13063e645a1665939ff4ec6e9992f8d79b934c401aca7d7620375fddf3c73bb
|
|
678
|
+
record: .nukadoko/runs/run-20261203-234049-hhaj/steps/step-20261203-234049-0wcs/record.json
|
|
679
|
+
fix: judge each value against its quality, then record it: nuka judge features/greeting.feature:3 --run run-20261203-234049-hhaj --meets or --misses --by <who> --because <one sentence>
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
A judge who did not write the change reads the value and records the judgment:
|
|
683
|
+
|
|
684
|
+
```sh
|
|
685
|
+
nuka judge features/greeting.feature:3 --meets --by "Rin" --because "It welcomes the visitor and invites them in."
|
|
686
|
+
```
|
|
687
|
+
|
|
688
|
+
```text
|
|
689
|
+
meets features/greeting.feature:3 line 5 claim 0 sha256:a13063e645a1665939ff4ec6e9992f8d79b934c401aca7d7620375fddf3c73bb
|
|
690
|
+
wrote judgments/features/greeting.feature.json: commit it, so its review records who judged; the next run reads features/greeting.feature:3 against it
|
|
691
|
+
do: nuka run features/greeting.feature:3
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
### Common mistakes
|
|
695
|
+
|
|
696
|
+
- **The line of the Then, not of the Scenario.** `nuka judge features/greeting.feature:5` names the Then line, and the run ran no criterion there:
|
|
697
|
+
|
|
698
|
+
```text
|
|
699
|
+
refused judgment-refused - run-20261203-234049-hhaj ran no criterion at features/greeting.feature:5
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
- **A judgment without `--because`.** `--meets` or `--misses` needs both `--by` and `--because`: `refused judgment-refused - a judgment needs --by, the judge's name, and --because, why the value meets or misses the sentence, in one sentence`. Both `--meets` and `--misses` together are refused too.
|
|
703
|
+
- **A value that step code computed.** A judgment can cite only a value that a channel of a step record holds (a response, the output of a process, a file, or the ARIA snapshot of a page). In the second scenario (line 7), the step `a-cart` computes the total in step code. The run reports `judgment-uncitable`. `nuka judge features/greeting.feature:7` shows the value with the state `uncitable` and exits 0. A judgment of it, such as `nuka judge features/greeting.feature:7 --meets --by <name> --because <sentence>`, is refused with `judgment-refused` and exits 2: `line 9 read from:a-cart@8.total, which no channel of a step record holds, so a judgment cannot cite it`.
|
|
704
|
+
|
|
705
|
+
The full text: [Judgments](spec.md#judgments).
|
|
706
|
+
|
|
707
|
+
## nuka steps and nuka describe
|
|
708
|
+
|
|
709
|
+
### Synopsis
|
|
710
|
+
|
|
711
|
+
```text
|
|
712
|
+
nuka steps [<target>...] [--json]
|
|
713
|
+
nuka describe <name>
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### What it does
|
|
717
|
+
|
|
718
|
+
`nuka steps` lists the vocabulary of the project, typed and compat: the name of each step, its file, its patterns, its description, whether it mutates, and its claims.
|
|
719
|
+
With a target (a feature file, `file:line`, or a directory, selected the way `nuka run` selects them), it lists only the steps that those lines bind, and the steps they call through parts, each with the lines that bind it.
|
|
720
|
+
`nuka describe` prints the full contract of one step as a JSON envelope, with its args and returns as JSON Schema.
|
|
721
|
+
Read both before you write a feature line or a new step, so that you use a step that exists.
|
|
722
|
+
Both commands load each step file on its own, so one step file that does not load does not hide the others.
|
|
723
|
+
|
|
724
|
+
`nuka steps` takes zero or more targets. `nuka describe` takes one step name, as `nuka steps` lists it.
|
|
725
|
+
|
|
726
|
+
### Flags
|
|
727
|
+
|
|
728
|
+
| Flag | Meaning | Default |
|
|
729
|
+
| --- | --- | --- |
|
|
730
|
+
| `--json` | `nuka steps` only: print the envelope with a `steps` array on stdout. `nuka describe` always prints JSON and has no flags. | `false` |
|
|
731
|
+
|
|
732
|
+
### Writes
|
|
733
|
+
|
|
734
|
+
Nothing.
|
|
735
|
+
|
|
736
|
+
### Exit codes
|
|
737
|
+
|
|
738
|
+
- `0`: it listed the vocabulary or printed the contract.
|
|
739
|
+
- `1`: on `nuka steps`, a line of a target that no step binds (`undefined-step`), or a step file that did not load (`step-file-import-failed`).
|
|
740
|
+
- `2`: it refused: a target that does not exist (`target-not-found`), a line where no scenario starts (`no-scenario-at-line`), or, on `nuka describe`, a step name it does not know (`unknown-step`).
|
|
741
|
+
|
|
742
|
+
Differences between the engines:
|
|
743
|
+
|
|
744
|
+
| Case | TypeScript engine | Ruby engine |
|
|
745
|
+
| --- | --- | --- |
|
|
746
|
+
| `nuka steps` with a step file that does not load | Prints `step-file-import-failed` with the file, and exits 1. | Prints the finding only with `--json`, and exits 0. |
|
|
747
|
+
| `nuka describe` with an unknown step name | Exits 2. | Exits 1. |
|
|
748
|
+
| The `file` of a step | `features/steps/run-greet.ts` | `features/steps/run_greet.rb` |
|
|
749
|
+
|
|
750
|
+
### Example
|
|
751
|
+
|
|
752
|
+
On the greet project:
|
|
753
|
+
|
|
754
|
+
```sh
|
|
755
|
+
nuka steps features/greet.feature:8
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
```text
|
|
759
|
+
error-says typed claims
|
|
760
|
+
the error says {text:string}
|
|
761
|
+
TODO: describe error-says
|
|
762
|
+
claim: stderr as text equal text
|
|
763
|
+
lines: features/greet.feature:11
|
|
764
|
+
|
|
765
|
+
exits-with typed claims
|
|
766
|
+
it exits with {code:int}
|
|
767
|
+
TODO: describe exits-with
|
|
768
|
+
claim: exitCode equal code
|
|
769
|
+
lines: features/greet.feature:10
|
|
770
|
+
|
|
771
|
+
run-greet typed mutates
|
|
772
|
+
I run greet with {name:string}
|
|
773
|
+
Run the command under test in an empty scratch directory, with name split on
|
|
774
|
+
whitespace into its arguments
|
|
775
|
+
lines: features/greet.feature:9
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
The `TODO` lines are the descriptions that `nuka scaffold` wrote. Replace them with what each step means.
|
|
779
|
+
|
|
780
|
+
```sh
|
|
781
|
+
nuka describe run-greet
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
```json
|
|
785
|
+
{
|
|
786
|
+
"schema_version": 4,
|
|
787
|
+
"nukadoko": "0.29.0",
|
|
788
|
+
"command": "describe",
|
|
789
|
+
"verdict": "passed",
|
|
790
|
+
"findings": [],
|
|
791
|
+
"kind": "typed",
|
|
792
|
+
"name": "run-greet",
|
|
793
|
+
"file": "features/steps/run-greet.ts",
|
|
794
|
+
"patterns": [
|
|
795
|
+
"I run greet with {name:string}"
|
|
796
|
+
],
|
|
797
|
+
"description": "Run the command under test in an empty scratch directory, with name split on whitespace into its arguments",
|
|
798
|
+
"mutates": true,
|
|
799
|
+
"needs": [
|
|
800
|
+
"scratch"
|
|
801
|
+
],
|
|
802
|
+
"needs_browser": false,
|
|
803
|
+
"args": {
|
|
804
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
805
|
+
"type": "object",
|
|
806
|
+
"properties": {
|
|
807
|
+
"name": {
|
|
808
|
+
"type": "string"
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
"required": [
|
|
812
|
+
"name"
|
|
813
|
+
],
|
|
814
|
+
"additionalProperties": false
|
|
815
|
+
},
|
|
816
|
+
"returns": {
|
|
817
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
818
|
+
"type": "object",
|
|
819
|
+
"properties": {
|
|
820
|
+
"exitCode": {
|
|
821
|
+
"type": [
|
|
822
|
+
"number",
|
|
823
|
+
"null"
|
|
824
|
+
]
|
|
825
|
+
},
|
|
826
|
+
"stdout": {
|
|
827
|
+
"type": "string"
|
|
828
|
+
},
|
|
829
|
+
"stderr": {
|
|
830
|
+
"type": "string"
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
"required": [
|
|
834
|
+
"exitCode",
|
|
835
|
+
"stdout",
|
|
836
|
+
"stderr"
|
|
837
|
+
],
|
|
838
|
+
"additionalProperties": false
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
### Common mistakes
|
|
844
|
+
|
|
845
|
+
- **A pattern or a file name instead of the step name.** `nuka describe "I run greet with"` and `nuka describe run_greet` are refused with `unknown-step`. Use the name that `nuka steps` prints, such as `run-greet`.
|
|
846
|
+
- **The line of a step instead of the line of a scenario.** `nuka steps features/greet.feature:5` is refused: `refused no-scenario-at-line - No scenario found at features/greet.feature:5`. The fix names the lines where scenarios start.
|
|
847
|
+
- **A step file that does not load.** The other steps are still listed, and the steps of that file are missing. Run `nuka check`: it names the file as `step-file-import-failed` in both engines. Then correct the file.
|
|
848
|
+
|
|
849
|
+
The full text: [CLI summary](spec.md#cli-summary).
|
|
850
|
+
|
|
851
|
+
## nuka do
|
|
852
|
+
|
|
853
|
+
### Synopsis
|
|
854
|
+
|
|
855
|
+
```text
|
|
856
|
+
nuka do <name> [--args '<json>'] [--use <step-record-id>]... [--env <name>]
|
|
857
|
+
```
|
|
858
|
+
|
|
859
|
+
### What it does
|
|
860
|
+
|
|
861
|
+
`nuka do` runs one typed step outside any scenario and prints its step record on stdout.
|
|
862
|
+
A claim step reads its values, judges every claim, and records the outcome as a run does.
|
|
863
|
+
A step record is the JSON file that one step leaves: its args, its result, what nukadoko measured, and the outcome of each claim.
|
|
864
|
+
Each call starts clean. The config can name a program under test (see [Program](spec.md#program)). If it does, `nuka do` starts that program for this one call and stops it after.
|
|
865
|
+
A `from` key is a step argument that the step takes from the result of an earlier step.
|
|
866
|
+
`--use` fills these keys from an earlier step record, of a `nuka do` or of a run. So you can chain calls the way a scenario chains steps.
|
|
867
|
+
Text that the step or its fixtures print goes to stderr, so stdout holds one JSON value.
|
|
868
|
+
|
|
869
|
+
The positional `<name>` is the step name, as `nuka steps` lists it.
|
|
870
|
+
|
|
871
|
+
### Flags
|
|
872
|
+
|
|
873
|
+
| Flag | Meaning | Default |
|
|
874
|
+
| --- | --- | --- |
|
|
875
|
+
| `--args <json>` | The step arguments as a JSON object. You can leave it out only when `--use` supplies every key. | none |
|
|
876
|
+
| `--use <step-record-id>` | A step record id whose result fills the `from` keys of this step. Repeatable. `--args` wins for a key that it also sets. | none |
|
|
877
|
+
| `--env <name>` | Run in a named environment of the program. | `default` |
|
|
878
|
+
|
|
879
|
+
### Writes
|
|
880
|
+
|
|
881
|
+
`.nukadoko/do/<step_record_id>/`: the step record and its evidence.
|
|
882
|
+
|
|
883
|
+
### Exit codes
|
|
884
|
+
|
|
885
|
+
- `0`: the step passed.
|
|
886
|
+
- `1`: the step failed (for example `args_invalid` or `claim_broken` in the record's `error.kind`). The record is still on stdout.
|
|
887
|
+
- `2`: it refused, and nothing ran: an unknown step (`unknown-step`), no `--args` and no `--use` (`step-args-invalid`), or an unknown environment (`unknown-environment`).
|
|
888
|
+
- `128 + n`: it stopped on signal n after its teardown (130 for SIGINT).
|
|
889
|
+
|
|
890
|
+
### Example
|
|
891
|
+
|
|
892
|
+
On the greet project, run the When step first:
|
|
893
|
+
|
|
894
|
+
```sh
|
|
895
|
+
nuka do run-greet --args '{"name":"Ada"}'
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
It prints the step record of `run-greet`, with `"status": "passed"` and `"step_record_id": "step-20261203-230945-3132"`.
|
|
899
|
+
Then run the Then step on its result:
|
|
900
|
+
|
|
901
|
+
```sh
|
|
902
|
+
nuka do output-is --args '{"text":"Hello, Ada!"}' --use step-20261203-230945-3132
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
The TypeScript engine prints this record. The Ruby engine prints the same record with two differences: each entry of `used` also holds the `result` of that record, and the `measured` of the claim is `null`.
|
|
906
|
+
|
|
907
|
+
<!-- engine: typescript -->
|
|
908
|
+
```json
|
|
909
|
+
{
|
|
910
|
+
"schema_version": 4,
|
|
911
|
+
"nukadoko": "0.29.0",
|
|
912
|
+
"step_record_id": "step-20261203-230948-qr8b",
|
|
913
|
+
"step": "output-is",
|
|
914
|
+
"kind": "do",
|
|
915
|
+
"args": {
|
|
916
|
+
"text": "Hello, Ada!",
|
|
917
|
+
"stdout": "Hello, Ada!\n"
|
|
918
|
+
},
|
|
919
|
+
"args_origin": {
|
|
920
|
+
"text": "command_line",
|
|
921
|
+
"stdout": {
|
|
922
|
+
"from": {
|
|
923
|
+
"step_record_id": "step-20261203-230945-3132",
|
|
924
|
+
"step": "run-greet",
|
|
925
|
+
"key": "stdout"
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
},
|
|
929
|
+
"result": {},
|
|
930
|
+
"status": "passed",
|
|
931
|
+
"environment": "default",
|
|
932
|
+
"system_name": null,
|
|
933
|
+
"scenario_record_id": null,
|
|
934
|
+
"run_id": null,
|
|
935
|
+
"started_at": "2026-12-03T23:09:48.825Z",
|
|
936
|
+
"finished_at": "2026-12-03T23:09:48.830Z",
|
|
937
|
+
"evidence": {
|
|
938
|
+
"dir": ".nukadoko/do/step-20261203-230948-qr8b",
|
|
939
|
+
"screenshots": []
|
|
940
|
+
},
|
|
941
|
+
"observed": {
|
|
942
|
+
"processes": null,
|
|
943
|
+
"http": null,
|
|
944
|
+
"files": null,
|
|
945
|
+
"unmeasured": []
|
|
946
|
+
},
|
|
947
|
+
"mutates": false,
|
|
948
|
+
"used": [
|
|
949
|
+
{
|
|
950
|
+
"step_record_id": "step-20261203-230945-3132",
|
|
951
|
+
"step": "run-greet"
|
|
952
|
+
}
|
|
953
|
+
],
|
|
954
|
+
"claims": [
|
|
955
|
+
{
|
|
956
|
+
"actual": "Hello, Ada!",
|
|
957
|
+
"actual_from": "from:run-greet@step-20261203-230945-3132.stdout as text",
|
|
958
|
+
"view": "text",
|
|
959
|
+
"compare": "equal",
|
|
960
|
+
"expected": "Hello, Ada!",
|
|
961
|
+
"expected_from": "command_line:text",
|
|
962
|
+
"expected_text": "\"Hello, Ada!\"",
|
|
963
|
+
"outcome": "held",
|
|
964
|
+
"measured": {
|
|
965
|
+
"step_record_id": "step-20261203-230945-3132",
|
|
966
|
+
"channel": "observed.processes[0].stdout"
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
],
|
|
970
|
+
"observation": "observed",
|
|
971
|
+
"attempts": 1
|
|
972
|
+
}
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
### Common mistakes
|
|
976
|
+
|
|
977
|
+
- **No `--args`.** `nuka do run-greet` is refused: `refused step-args-invalid - --args is required unless --use supplies this step's arguments`. Its `do` is `nuka describe run-greet`, which lists the keys.
|
|
978
|
+
- **A claim step without `--use`.** `nuka do output-is --args '{"text":"Hello, Ada!"}'` runs, but the step fails with `"kind": "args_invalid"`, because nothing fills its `from` key `stdout`. Add `--use` with the id of a `run-greet` record.
|
|
979
|
+
- **An environment the program does not define.** `--env staging` is refused with `unknown-environment` when the program in the config has no `staging`.
|
|
980
|
+
|
|
981
|
+
The full text: [Single steps (the agent path)](spec.md#single-steps-the-agent-path).
|
|
982
|
+
|
|
983
|
+
## nuka step
|
|
984
|
+
|
|
985
|
+
### Synopsis
|
|
986
|
+
|
|
987
|
+
```text
|
|
988
|
+
nuka step wait [--walk <n>] [--timeout <s>] [--json]
|
|
989
|
+
nuka step next <pause> --walk <n> [--timeout <s>] [--json]
|
|
990
|
+
nuka step stop <pause> --walk <n> [--timeout <s>] [--json]
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
### What it does
|
|
994
|
+
|
|
995
|
+
`nuka run <feature>:<line> --step` starts a walk: it runs one scenario and pauses after each step, with the system, the browser, and the fixtures still open.
|
|
996
|
+
A walk is one run of one scenario that waits for you after each step.
|
|
997
|
+
`nuka step` follows and answers that walk from another shell.
|
|
998
|
+
`nuka step wait` waits until the walk pauses or ends, and prints where it stands: the step, its record, the views of the open pages, and the next commands.
|
|
999
|
+
`nuka step next` answers the pause by running the next step, and `nuka step stop` answers it by stopping: the steps after it do not run, the After hooks and the teardown do, and the scenario is recorded as stopped.
|
|
1000
|
+
Either engine's `nuka step` answers either engine's walk.
|
|
1001
|
+
|
|
1002
|
+
The positional `<pause>` of `next` and `stop` is the pause number that `nuka step wait` printed. It is also the number of the step that ran.
|
|
1003
|
+
|
|
1004
|
+
### Flags
|
|
1005
|
+
|
|
1006
|
+
| Flag | Meaning | Default |
|
|
1007
|
+
| --- | --- | --- |
|
|
1008
|
+
| `--walk <n>` | The walk, as a pause printed it. Required on `next` and `stop`, so that the same command cannot answer a later walk. | on `wait`: the newest walk |
|
|
1009
|
+
| `--timeout <s>` | Seconds to wait for the walk to reach a pause or its end. A walk that is still on its way is then reported as starting or running, and the same command waits again. | `90` |
|
|
1010
|
+
| `--json` | Print the walk as one JSON document on stdout, and nothing on stderr. | `false` |
|
|
1011
|
+
|
|
1012
|
+
### Writes
|
|
1013
|
+
|
|
1014
|
+
`nuka step next` and `nuka step stop` write the answer under `.nukadoko/runs/<run_id>/answers/`.
|
|
1015
|
+
When a `nuka step` call prints how a walk ended, it notes that in `.nukadoko/walks-reported/`.
|
|
1016
|
+
The walk itself (`nuka run --step`) writes `.nukadoko/walk.json`, `.nukadoko/walk.lock/`, and a screenshot and an ARIA snapshot of each open page under `.nukadoko/runs/<run_id>/pauses/<n>/`.
|
|
1017
|
+
|
|
1018
|
+
### Exit codes
|
|
1019
|
+
|
|
1020
|
+
- `0`: the walk waits at a pause after a step that passed, it has not reached a pause yet (`nuka step` reports it as starting or running), or it ended with all its steps passed.
|
|
1021
|
+
- `1`: the walk waits at a pause where its scenario failed, or it ended with a failure, for example a stop (`walk-stopped`) or a refusal before its scenario ran.
|
|
1022
|
+
- `2`: it refused: an answer to a pause that already has another answer (`pause-answered`), to a pause the walk is not at (`pause-not-current`), to a walk that is not the walk in the project (`walk-not-current`), `next` or `stop` without `--walk` (`invalid-value`), or no walk to wait for (`walk-not-found`).
|
|
1023
|
+
|
|
1024
|
+
### Example
|
|
1025
|
+
|
|
1026
|
+
On the greet project, start the walk in the background:
|
|
1027
|
+
|
|
1028
|
+
```sh
|
|
1029
|
+
nuka run features/greet.feature:3 --step &
|
|
1030
|
+
nuka step wait
|
|
1031
|
+
```
|
|
1032
|
+
|
|
1033
|
+
```text
|
|
1034
|
+
walk 1 paused after step 1/3 (passed): I run greet with "Ada"
|
|
1035
|
+
scenario: features/greet.feature:3 greets by name (default)
|
|
1036
|
+
record: .nukadoko/runs/run-20261203-231000-pj9g/steps/step-20261203-231000-4wyz/record.json
|
|
1037
|
+
do: nuka step next 1 --walk 1 (or: nuka step stop 1 --walk 1)
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
```sh
|
|
1041
|
+
nuka step next 1 --walk 1
|
|
1042
|
+
```
|
|
1043
|
+
|
|
1044
|
+
```text
|
|
1045
|
+
walk 1 paused after step 2/3 (passed): it exits with 0
|
|
1046
|
+
scenario: features/greet.feature:3 greets by name (default)
|
|
1047
|
+
record: .nukadoko/runs/run-20261203-231000-pj9g/steps/step-20261203-231004-wojw/record.json
|
|
1048
|
+
do: nuka step next 2 --walk 1 (or: nuka step stop 2 --walk 1)
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
```sh
|
|
1052
|
+
nuka step stop 2 --walk 1
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
```text
|
|
1056
|
+
walk 1 ended: stopped after step 2 (line 5), exit 1
|
|
1057
|
+
run: .nukadoko/runs/run-20261203-231000-pj9g/run.json
|
|
1058
|
+
failed walk-stopped features/greet.feature:3 greets by name: the walk was stopped after step 2 (line 5) with nuka step stop, so the steps after it did not run
|
|
1059
|
+
do: nuka run features/greet.feature:3
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
The run in the background prints `1 scenario: 0 passed, 0 failed, 1 stopped` and exits 1.
|
|
1063
|
+
When you answer the last pause with `next` instead, the walk ends with `walk 1 ended: the run finished, exit 0`.
|
|
1064
|
+
|
|
1065
|
+
### Common mistakes
|
|
1066
|
+
|
|
1067
|
+
- **A walk of more than one scenario.** `nuka run features/greet.feature --step` is refused, because the file holds two scenarios:
|
|
1068
|
+
|
|
1069
|
+
```text
|
|
1070
|
+
refused step-needs-one-scenario - nuka run --step walks one execution of one scenario, and the targets select 2 scenarios
|
|
1071
|
+
fix: Name one scenario with <file>:<line>, one environment with --env, and leave out --repeat and --base.
|
|
1072
|
+
do: nuka run features/greet.feature:3 --step
|
|
1073
|
+
```
|
|
1074
|
+
|
|
1075
|
+
The refused run still counts as a walk and takes a walk number. After it, `nuka step wait` prints `walk 1 ended before its scenario ran, exit 2` and exits 1, and the next walk is walk 2. Answer with the walk number that `nuka step wait` prints.
|
|
1076
|
+
|
|
1077
|
+
- **An answer to an old pause.** After `nuka step next 1 --walk 1`, the command `nuka step stop 1 --walk 1` is refused with `pause-answered`, and `nuka step next 3 --walk 1` with `pause-not-current`. Run `nuka step wait --walk 1` and answer the pause it prints. The same answer again is not an error: it prints the same pause.
|
|
1078
|
+
- **The wrong walk number.** `nuka step next 1 --walk 2` while walk 1 runs is refused with `walk-not-current`.
|
|
1079
|
+
|
|
1080
|
+
The full text: [A walk with a person](spec.md#a-walk-with-a-person).
|
|
1081
|
+
|
|
1082
|
+
## nuka clean
|
|
1083
|
+
|
|
1084
|
+
### Synopsis
|
|
1085
|
+
|
|
1086
|
+
```text
|
|
1087
|
+
nuka clean [--dry-run] [--json]
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
### What it does
|
|
1091
|
+
|
|
1092
|
+
`nuka clean` deletes what runs collect in the state directory, `.nukadoko/`: the run directories, the `nuka do` records, and what `nuka report` wrote under `export/`.
|
|
1093
|
+
Under `export/`, it deletes only the files that a run's manifest names and the contents of `allure-results/`. Every other file stays.
|
|
1094
|
+
It also deletes the `cache/` and `records/` directories that earlier releases left.
|
|
1095
|
+
It keeps the run directory of a walk that is live, and says so with the note `walk-run-kept`.
|
|
1096
|
+
With `--dry-run`, it prints the same list and deletes nothing.
|
|
1097
|
+
|
|
1098
|
+
### Flags
|
|
1099
|
+
|
|
1100
|
+
| Flag | Meaning | Default |
|
|
1101
|
+
| --- | --- | --- |
|
|
1102
|
+
| `--dry-run` | List what it would remove, and remove nothing. | `false` |
|
|
1103
|
+
| `--json` | Print the envelope on stdout, with `records`, `export`, `legacy`, `kept`, and `dry_run`. | `false` |
|
|
1104
|
+
|
|
1105
|
+
### Writes
|
|
1106
|
+
|
|
1107
|
+
It removes the paths that it prints on stdout. The `walk-run-kept` note goes to stderr.
|
|
1108
|
+
It also removes, with git, the base trees that a killed `nuka run --base` left registered.
|
|
1109
|
+
When `export/allure-results/` existed, it creates that directory again, empty, so that an `allure watch` on it keeps working.
|
|
1110
|
+
It writes no file.
|
|
1111
|
+
|
|
1112
|
+
### Exit codes
|
|
1113
|
+
|
|
1114
|
+
- `0`: it removed the paths, listed them, or found nothing to clean.
|
|
1115
|
+
- `2`: the command line is wrong, for example an unknown flag (`invalid-arguments`).
|
|
1116
|
+
|
|
1117
|
+
### Example
|
|
1118
|
+
|
|
1119
|
+
On the greet project, while a walk is live:
|
|
1120
|
+
|
|
1121
|
+
```sh
|
|
1122
|
+
nuka clean --dry-run
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
```text
|
|
1126
|
+
.nukadoko/runs/run-20261203-230843-lucw
|
|
1127
|
+
.nukadoko/runs/run-20261203-230850-flr8
|
|
1128
|
+
.nukadoko/runs/run-20261203-231000-pj9g
|
|
1129
|
+
.nukadoko/do/step-20261203-230945-3132
|
|
1130
|
+
.nukadoko/do/step-20261203-230948-qr8b
|
|
1131
|
+
.nukadoko/do/step-20261203-230954-17aw
|
|
1132
|
+
.nukadoko/do/step-20261203-230956-4rzk
|
|
1133
|
+
note walk-run-kept - kept .nukadoko/runs/run-20261203-231039-mxur: walk 3 is live and its run writes there
|
|
1134
|
+
do: nuka step wait --walk 3
|
|
1135
|
+
```
|
|
1136
|
+
|
|
1137
|
+
After the walk ended, `nuka clean` removed every run directory and every `do` record, and a second `nuka clean` printed:
|
|
1138
|
+
|
|
1139
|
+
```text
|
|
1140
|
+
ok: nothing to clean
|
|
1141
|
+
```
|
|
1142
|
+
|
|
1143
|
+
### Common mistakes
|
|
1144
|
+
|
|
1145
|
+
- **A clean during a walk.** The run directory of the live walk stays (`walk-run-kept`). End the walk with `nuka step stop`, then run `nuka clean` again.
|
|
1146
|
+
- **A clean to keep evidence.** `nuka clean` deletes every run, with its `run.json`, step records, and traces. `nuka verdict` then reports `run-missing`. Copy a run directory that you want to keep before you clean.
|
|
1147
|
+
|
|
1148
|
+
The full text: [The state directory](spec.md#the-state-directory).
|
|
1149
|
+
|
|
1150
|
+
## nuka skill
|
|
1151
|
+
|
|
1152
|
+
### Synopsis
|
|
1153
|
+
|
|
1154
|
+
```text
|
|
1155
|
+
nuka skill path
|
|
1156
|
+
```
|
|
1157
|
+
|
|
1158
|
+
### What it does
|
|
1159
|
+
|
|
1160
|
+
`nuka skill path` prints one absolute path: the directory that holds the agent skills that ship with the installed nukadoko.
|
|
1161
|
+
The directory holds two skills, `nukadoko` and `nukadoko-verification`, and both engines ship the same ones.
|
|
1162
|
+
Use it when you want the copy of a skill that matches the installed version, because a skill describes the CLI of one version.
|
|
1163
|
+
nukadoko does not copy the skills into an agent host. You copy them, or you install them with a skill installer.
|
|
1164
|
+
|
|
1165
|
+
### Flags
|
|
1166
|
+
|
|
1167
|
+
`nuka skill path` has no flags.
|
|
1168
|
+
|
|
1169
|
+
### Writes
|
|
1170
|
+
|
|
1171
|
+
Nothing.
|
|
1172
|
+
|
|
1173
|
+
### Exit codes
|
|
1174
|
+
|
|
1175
|
+
- `0`: it printed the path.
|
|
1176
|
+
- `2`: no subcommand, or an unknown one (`invalid-arguments`).
|
|
1177
|
+
|
|
1178
|
+
### Example
|
|
1179
|
+
|
|
1180
|
+
```sh
|
|
1181
|
+
ls "$(nuka skill path)"
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
```text
|
|
1185
|
+
nukadoko
|
|
1186
|
+
nukadoko-verification
|
|
1187
|
+
```
|
|
1188
|
+
|
|
1189
|
+
### Common mistakes
|
|
1190
|
+
|
|
1191
|
+
- **No subcommand.** `nuka skill` alone is refused: `refused invalid-arguments - Not enough non-option arguments: got 0, need at least 1`. Type `nuka skill path`.
|
|
1192
|
+
|
|
1193
|
+
The full text: [Skills for coding agents](../README.md#skills-for-coding-agents).
|
|
1194
|
+
|
|
1195
|
+
## nuka sig
|
|
1196
|
+
|
|
1197
|
+
### Synopsis
|
|
1198
|
+
|
|
1199
|
+
<!-- engine: ruby -->
|
|
1200
|
+
```text
|
|
1201
|
+
nuka sig
|
|
1202
|
+
```
|
|
1203
|
+
|
|
1204
|
+
### What it does
|
|
1205
|
+
|
|
1206
|
+
The TypeScript engine has no `nuka sig` command, because TypeScript checks the step bodies itself.
|
|
1207
|
+
In the Ruby engine, `nuka sig` writes `sig/nukadoko/steps.rbs`: the RBS of the args and the returns of each step.
|
|
1208
|
+
The file is for Steep: with it, a step body that reads an args key the contract does not declare is a type error.
|
|
1209
|
+
nukadoko does not set up Steep for you. The Steepfile must also load the signatures of the gem and of the libraries they name, and in this release Steep also reports errors in the scaffolded greet steps.
|
|
1210
|
+
Run it again after each change to the args or the returns of a step.
|
|
1211
|
+
|
|
1212
|
+
### Flags
|
|
1213
|
+
|
|
1214
|
+
`nuka sig` has no flags.
|
|
1215
|
+
|
|
1216
|
+
### Writes
|
|
1217
|
+
|
|
1218
|
+
`sig/nukadoko/steps.rbs`. It replaces the file when it exists.
|
|
1219
|
+
|
|
1220
|
+
### Exit codes
|
|
1221
|
+
|
|
1222
|
+
- `0`: it wrote the file.
|
|
1223
|
+
- `2`: the command line is wrong, for example an unknown flag (`invalid-arguments`).
|
|
1224
|
+
|
|
1225
|
+
### Example
|
|
1226
|
+
|
|
1227
|
+
On the greet project:
|
|
1228
|
+
|
|
1229
|
+
<!-- engine: ruby -->
|
|
1230
|
+
```sh
|
|
1231
|
+
bundle exec nuka sig
|
|
1232
|
+
```
|
|
1233
|
+
|
|
1234
|
+
<!-- engine: ruby -->
|
|
1235
|
+
```text
|
|
1236
|
+
wrote sig/nukadoko/steps.rbs
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
<!-- engine: ruby -->
|
|
1240
|
+
```rbs
|
|
1241
|
+
class ErrorSays < Nukadoko::Step
|
|
1242
|
+
class Args
|
|
1243
|
+
attr_reader stderr: String
|
|
1244
|
+
end
|
|
1245
|
+
|
|
1246
|
+
def observe: (args: Args) -> Hash[Symbol, untyped]
|
|
1247
|
+
end
|
|
1248
|
+
|
|
1249
|
+
class RunGreet < Nukadoko::Step
|
|
1250
|
+
class Args
|
|
1251
|
+
attr_reader name: String
|
|
1252
|
+
end
|
|
1253
|
+
|
|
1254
|
+
def run: (scratch: Nukadoko::Engine::Scratch, args: Args) -> { exitCode: (Numeric)?, stdout: String, stderr: String }
|
|
1255
|
+
end
|
|
1256
|
+
|
|
1257
|
+
class ExitsWith < Nukadoko::Step
|
|
1258
|
+
class Args
|
|
1259
|
+
attr_reader exitCode: (Numeric)?
|
|
1260
|
+
end
|
|
1261
|
+
|
|
1262
|
+
def observe: (args: Args) -> Hash[Symbol, untyped]
|
|
1263
|
+
end
|
|
1264
|
+
|
|
1265
|
+
class OutputIs < Nukadoko::Step
|
|
1266
|
+
class Args
|
|
1267
|
+
attr_reader stdout: String
|
|
1268
|
+
end
|
|
1269
|
+
|
|
1270
|
+
def observe: (args: Args) -> Hash[Symbol, untyped]
|
|
1271
|
+
end
|
|
1272
|
+
```
|
|
1273
|
+
|
|
1274
|
+
### Common mistakes
|
|
1275
|
+
|
|
1276
|
+
- **`nuka sig` in the TypeScript engine.** It is refused: `refused invalid-arguments - Unknown argument: sig`.
|
|
1277
|
+
- **A step file that does not load.** `nuka sig` leaves out each step that the file did not define before its error, and still exits 0. Run `nuka check` first: it reports the file as `step-file-import-failed`.
|
|
1278
|
+
|
|
1279
|
+
The full text: [Types and tooling](ruby/reference.md#types-and-tooling).
|
|
1280
|
+
|
|
1281
|
+
[Japanese](commands.ja.md)
|