an.cli_status#
A command’s report that also says how the command ended (an#480).
The CLI commands in an.tools return their report as a string and the
dispatcher prints it. A string cannot say “this is a failure”, so a command that
reported FAILED still exited 0 and no script or CI step could tell it from a
pass. CommandReport is a str that carries an exit_code: Python
callers, the MCP surface and the doctests see the same text as before, and the
dispatcher (an.__main__._printing) exits with the code after printing it.
>>> failed("validation: FAILED").exit_code, str(failed("validation: FAILED"))
(1, 'validation: FAILED')
>>> exit_code_of("a plain report"), exit_code_of(failed("x", exit_code=2))
(0, 2)
Module Attributes
The status of a command that reports a failure. |
|
How each core command ends when it fails. |
Functions
|
The status a command's return value asks for: 0 for anything that is not a |
|
|
Classes
|
A command's text with the exit status it asks the CLI to end with. |
- class an.cli_status.CommandReport(text, *, exit_code=0)[source]#
Bases:
strA command’s text with the exit status it asks the CLI to end with.
- Return type:
- an.cli_status.EXIT_POLICY: dict[str, str] = {'bench': 'failed: refused arguments (an#559)', 'bench-compare': 'failed: --strict and a bad answer (an#559)', 'bench-mutants': 'failed: a survivor, an unknown name, rot; 130 interrupted', 'cache gc': 'refuses', 'cache info': '0', 'check': '0: every backend is optional to some project; the render refuses', 'credits': '0: the inventory; the gate is `validate --strict-assets`', 'init': 'refuses', 'iterate': 'failed: the instruction was not applied (an#480)', 'library checkout': 'refuses', 'library find': '0: no match is an answer', 'library kit': 'refuses', 'library promote': 'refuses', 'library publish': 'refuses; an unknown licence is recorded on purpose: 0', 'library reindex': 'refuses', 'library retire': 'refuses', 'library sheet': 'refuses', 'library show': 'refuses', 'library vocabulary': '0', 'music add-library': 'failed: a title no mirror served (an#470); refuses: bad arguments', 'music use': 'refuses', 'preview': 'refuses', 'probe': 'refuses', 'props contract': '0', 'props validate': 'failed: a FAILED report (an#480)', 'render': 'failed: an error finding, though the mp4 exists (an#559)', 'sounds add': 'refuses', 'sounds sync': 'refuses', 'sync': 'refuses: a scene file that is not there; drift is a warning', 'validate': 'failed: a FAILED report (an#480)', 'voices audition': 'refuses (VoiceDesignError)', 'voices cast': 'refuses (VoiceDesignError)', 'voices choose': 'refuses (VoiceDesignError)', 'voices design': 'refuses (VoiceDesignError)', 'voices import': 'refuses (RecordedVoicesError)', 'voices list': '0: no voices is an answer', 'voices reroll': 'failed: no dialogue line matches (an#559)', 'voices rescore': 'failed: no dialogue line matches (an#559)', 'world from-shot': 'refuses', 'world show': 'refuses'}#
How each core command ends when it fails. A new command must take a line here (
tests/test_cli_exit_status.pyholds the list complete), so “it prints a failure and exits 0” is a decision someone wrote down, never a default.failed: a report that says it failed carries exit 1 (an.cli_status);refuses: a bad argument or state raises (SystemExit, a_REFUSALStype), exit 1;0: always 0, for the reason given.
- an.cli_status.exit_code_of(result)[source]#
The status a command’s return value asks for: 0 for anything that is not a
CommandReport.- Return type: