codespeak test

Run tests and iteratively fix failures.

Synopsis

codespeak test [spec_path] [--auto-configure] [--max-iterations N] [--no-interactive]

Description

Runs the project's test suite, and if tests fail, uses Claude to analyze the failures and fix the code. Repeats until all tests pass or the maximum number of iterations is reached.

Use --auto-configure to let CodeSpeak detect and save the test runner command to codespeak.json (it configures and exits without running tests).

Flags

FlagDescription
spec_pathPath to the specification file. If omitted, all registered specs are tested
--auto-configureAuto-detect and configure the test runner command for a spec. Mutually exclusive with --max-iterations
--max-iterations NMaximum number of test fix iterations (default: 3, max: 30)
--no-interactiveRun in non-interactive mode without real-time progress updates

Error messages

ErrorCauseResolution
Can't find spec to buildNo .cs.md files found and no specs registered in codespeak.jsonCreate a spec file or register one in codespeak.json
Cannot specify both a positional spec path and --specBoth positional path and --spec flag providedUse one or the other
Anthropic API Key not foundNo API key configuredSet the ANTHROPIC_API_KEY environment variable or run through the interactive setup
Circular spec dependency detected: A -> B -> ASpec imports form a cycleRemove the circular import
{path} does not belong to a CodeSpeak projectNo codespeak.json foundRun codespeak init first
--max-iterations must be between 1 and 30Invalid iteration countUse a value between 1 and 30
A placeholder test runner configuration was added to codespeak.jsonNo test runner config exists for the specRun codespeak test --auto-configure or manually edit codespeak.json
The test runner configuration still has placeholder valuesConfig fields still start with "TODO:"Replace placeholder values in codespeak.json
The 'run_all_tests_command' must include {tests_report_file} placeholderRequired macro missing from commandAdd the macro to the command string in codespeak.json
Test runner command failed to startConfigured command produces a shell errorFix the command in codespeak.json
Failed to fix all tests after N iterationsIterations exhausted with remaining failuresIncrease --max-iterations or fix tests manually
Failed to auto-detect test runner commandsAuto-configure couldn't find a test runnerManually configure in codespeak.json

See also