Exit codes
Every kscript command ends with one of these, so a CI job can tell "the checks failed" from "the command was wrong":
| Code | Meaning |
|---|---|
| 0 | Everything worked. |
| 1 | The command ran and found problems: kscript check found errors (or warnings, with --warnings-as-errors), tests failed, or a --check (fmt, agents, watch) found something out of date. |
| 2 | The command line or the settings are wrong: an unknown command or option, a missing value, a file or folder that is not there, or a kscript.json or standard that can't be used. |
| 3 | A script stopped with an error (or the code the script gave to exit). |
| 70 | An error inside kscript itself, also when it happens while a script runs. |
| 130 | Stopped with Ctrl+C. kscript serve and kscript watch run until they are stopped, so Ctrl+C is how they finish and they end with 0. |
Options are written one way on every command: --output text|json|yaml chooses how results are printed (check, queue, openapi), and --syntax kscript|xml chooses the script syntax (make, docs, mcp, convert). Flags are kebab-case (--warnings-as-errors, --stop-when-empty), and settings in kscript.json are snake_case (warnings_as_errors). --env name, --ansi, --no-ansi and --stack-trace work after any command (kscript worker --env staging); for a script they go before its name (kscript --env staging deploy.kscript, or kscript run --env staging deploy.kscript), because what follows the name is the script's $args.