CLI Commands
This page summarizes the SpecLeft CLI. Every command supports --format json for machine-readable output.
Planning and setup
Section titled “Planning and setup”specleft doctor
Section titled “specleft doctor”Verify your installation and environment.
specleft doctorspecleft doctor --format jsonspecleft init
Section titled “specleft init”Initialize .specleft/specs/ with a sample spec.
specleft initspecleft init --dry-run --format jsonspecleft plan
Section titled “specleft plan”Generate feature files from a prd.md file in the repo root.
specleft planspecleft plan --dry-runSpecs and inventory
Section titled “Specs and inventory”specleft features validate
Section titled “specleft features validate”Validate Markdown specs.
specleft features validatespecleft features validate --dir features --format jsonspecleft features list
Section titled “specleft features list”List features, stories, and scenarios.
specleft features listspecleft features stats
Section titled “specleft features stats”Show aggregate spec statistics.
specleft features statsTest generation and reporting
Section titled “Test generation and reporting”specleft test skeleton
Section titled “specleft test skeleton”Generate pytest skeletons from specs.
specleft test skeleton --dry-runspecleft test skeleton --features-dir features --output-dir testsKey options:
--single-file: generate all tests in one file--skip-preview: skip interactive confirmation--force: overwrite existing test files
specleft test report
Section titled “specleft test report”Generate an HTML report from test results.
specleft test reportspecleft test report --open-browserspecleft test report --format jsonWorkflow commands
Section titled “Workflow commands”specleft status
Section titled “specleft status”Show implemented vs skipped scenarios.
specleft statusspecleft status --unimplementedspecleft next
Section titled “specleft next”Show the next scenarios to implement.
specleft nextspecleft next --priority high --limit 5specleft coverage
Section titled “specleft coverage”Report spec-to-behaviour test coverage (not code coverage).
specleft coveragespecleft coverage --format badge --output coverage.svgEnforcement
Section titled “Enforcement”specleft enforce
Section titled “specleft enforce”Validate a signed policy file and enforce priority or coverage rules.
specleft enforcespecleft enforce .specleft/policy-core.ymlspecleft enforce --format jsonExit codes:
0: policy satisfied1: policy violated2: license issue
Agent contract
Section titled “Agent contract”specleft contract
Section titled “specleft contract”Show the agent safety guarantees.
specleft contractspecleft contract --format jsonspecleft contract test
Section titled “specleft contract test”Verify agent guarantees.
specleft contract test --verbose