CLI Reference
Catalog all commands, arguments, output, safety level, scripting behavior, and exit codes.
Abstract
This page is the machine-facing contract for the blackbox CLI. It answers three questions quickly: what command should I run, what does it change, and is it safe to script.
Audience
Developers and automation authors wiring Blackbox into local scripts, CI gates, and agent workflows.
Command Shape
The public binary is blackbox, provided by @suites/blackbox-cli. Commands use a space topic separator:
blackbox features emit ./tests --out ./featuresblackbox coverage replay --coverage-dir .blackbox-coverageUse blackbox features emit, not blackbox features:emit.
Command Families
The CLI has three command families:
features: generate, lint, drift-check, reshape, and compare feature artifacts.coverage: replay OMC/DC reports from saved runtime evidence.otel: build-time static OpenTelemetry instrumentation utilities.
Command Matrix
| Command | Job | Reads | Writes | JSON | Dry run | Stability |
|---|---|---|---|---|---|---|
blackbox features emit [paths...] | Decompile Playwright or BDD-DSL tests into .feature files. | Test source files; optional step library. | .feature files under --out or ./features. | No | No | Alpha public |
blackbox features lint [paths...] | Run structural rules against test sources. | Test source files. | Nothing. | Yes, --json | N/A | Alpha public |
blackbox features drift | Detect generated feature files that drifted from source tests. | --tests, --features, optional steps. | Nothing. | No | N/A | Alpha public |
blackbox features check | Validate .feature syntax and source/feature drift. | --features, --tests. | Nothing. | Yes, --json | N/A | Alpha public |
blackbox features reshape [paths...] | Rewrite Playwright system tests into Blackbox closure-DSL shape. | Test source files. | --write writes reshaped tests under --out; otherwise prints source. | No | Yes, --dry-run | Alpha public, state-changing |
blackbox features compare-observations | Compare observation-reporter outputs from two runs. | --baseline, --candidate directories with .observation.json. | Nothing. | Yes, --json | N/A | Experimental |
blackbox features experimental wrap [paths...] | Annotate Playwright specs so the Gherkin reporter can emit feature files at runtime. | Test source files. | Only with --write; otherwise prints what would change. | No | Implicit preview without --write | Experimental |
blackbox features experimental scaffold [paths...] | Generate starter closure-DSL tests from .feature files. | .feature files. | Only with --write; otherwise prints generated source. | No | Implicit preview without --write | Experimental |
blackbox coverage replay | Recompute OMC/DC reports from saved .blackbox-coverage evidence. | --coverage-dir; optional service source map. | Report files under --out or coverage dir. | No | No | Alpha public, state-changing |
blackbox otel instrument | Transform source files with static OpenTelemetry function-span instrumentation. | --input source tree; optional config. | Instrumented source tree under --output. | No | No | Advanced/experimental |
Feature Commands
features emit
blackbox features emit ./tests --out ./featuresblackbox features emit ./tests --steps ./scripts/step-lib.jsonblackbox features emit ./tests --no-stepsDefaults to reading tests and writing to features when no paths or --out are supplied. This command writes files and should be reviewed before committing generated feature changes.
features lint
blackbox features lint ./testsblackbox features lint ./tests --jsonblackbox features lint ./tests --fail-on error --scope backendRead-only. --fail-on accepts error, warn, or info. --scope accepts backend, browser-only, or all.
features drift
blackbox features drift --tests ./tests --features ./featuresblackbox features drift --no-stepsRead-only. Use it when feature files are generated artifacts that must stay synchronized with source tests.
features check
blackbox features checkblackbox features check --features ./features --tests ./testsblackbox features check --skip-drift --jsonRead-only. Defaults to --features ./features and --tests ./tests. Use this as the durable CI gate for feature syntax plus drift.
features reshape
blackbox features reshape ./tests/my.spec.ts --dry-runblackbox features reshape ./tests/my.spec.ts --writeblackbox features reshape ./tests/my.spec.ts --out ./reshaped --testbed ./testbed.jsState-changing only with --write. --dry-run and --write are mutually exclusive.
Coverage Commands
coverage replay
blackbox coverage replay --coverage-dir .blackbox-coverage --out reportsblackbox coverage replay --no-htmlblackbox coverage replay --service bff=/path/to/bff/src --service order=/path/to/order/srcReplays reports from saved runtime evidence. By default it writes OMC/DC JSON, Markdown, HTML, Istanbul coverage-final.json, and Istanbul HTML. With --no-html, it writes only omcdc-propagation.json and omcdc-propagation.md.
Static Instrumentation Commands
otel instrument
blackbox otel instrument --input ./src --output ./instrumented --config ./otel.jsonblackbox otel instrument -i ./src -o ./instrumented --include 'services/**/*.ts' --verboseThis is a build-time instrumentation command. It walks --input, transforms matching files, and writes the output tree to --output. It is separate from the default testbed bootstrap path.
Practical Defaults
- Use
features check --jsonin automation when you need structured feature syntax and drift output. - Run
features reshape --dry-runbefore anyfeatures reshape --writeflow. - Treat
coverage replayas a report regeneration command over saved evidence, not as the command that runs the system test. - Use project scripts such as
pnpm test:systemto run the actual system test and collect evidence.