semtest/Reference/Commands
Reference

Commands

Complete CLI reference for semtest.

semtest run

Run semantic tests and generate reports.

bash
semtest run [files...] [options]

Arguments

ArgumentDescription
[files...]Optional test files or directories. Runs all discovered tests if omitted.

You can pass individual spec files, directories, or a mix:

bash
# Run all tests
semtest run

# Run a single file
semtest run semtests/auth.spec.md

# Run a directory
semtest run semtests/api/

# Run multiple targets
semtest run semtests/auth.spec.md semtests/api/

Options

FlagDescriptionDefault
--tag <tags>Comma-separated tag filteroff
-t, --testNamePattern <pattern>Regex filter on test name or file pathoff
--repeat <n>Run each test N times1
--bailStop after first failureoff
--maxfail <n>Stop after N failuresoff
--verboseShow detailed per-test outputoff
--timestampGenerate a timestamped copy of the Markdown reportoff
--include-passingInclude passing tests in the Markdown reportoff
--strictExit code 2 if validation issues are foundoff
--skip-validationSkip post-run validation checksoff
--debugLog raw LLM output to a debug directoryoff
--timeout <ms>Per-test timeout in milliseconds0 (none)
--junitGenerate a JUnit XML reportoff
--skip-permissions-if-possibleSkip tool permission prompts where supportedoff

Empty LLM responses are automatically retried up to 3 times per test before being marked as an error. Only empty responses trigger retries โ€” parse failures and non-zero exit codes do not.

CLI flags override config file values. See Configuration for the full list of config properties.

Filtering examples

Filter by tags defined in spec frontmatter:

bash
# Run only tests tagged "ci"
semtest run --tag ci

# Run tests tagged "security" or "auth"
semtest run --tag security,auth

Filter by test name or file path using a regex:

bash
# Run tests with "auth" in the name or path
semtest run -t auth

# Run tests matching a pattern
semtest run -t "api.*validation"

Exit codes

CodeMeaning
0All tests passed
1One or more tests failed
2Error: LLM failure, invalid config, bad CLI arguments, or validation issues with --strict

semtest list

List all available model keys.

bash
semtest list [options]

Options

FlagDescription
--jsonOutput as JSON

By default, model keys are printed grouped by tool with the underlying model name. Use --json for machine-readable output.

bash
# Human-readable grouped output
semtest list

# JSON output
semtest list --json

semtest init

Scaffold a new semtest setup in the current directory.

bash
semtest init

Creates:

FileDescription
semtest.config.tsConfiguration file with sensible defaults

This command is idempotent. If the config file already exists, it's skipped.


semtest uninstall

Print uninstall instructions for your installation method.

bash
semtest uninstall

Output:

text
To uninstall semtest, run the command for your installation method:

npm:      npm uninstall -g @westopp/semtest
Homebrew: brew uninstall semtest