eval to exercise a local script in the sandbox, then use run --no-save to verify the stored version through the platform. A passing mock test validates your Lua logic, not the availability or permissions of a live capability.
Configure sandbox access before using eval. If your setup does not include a sandbox, go to Test the platform path.
Run a chunk or a transform
eval resolves files from the current directory, not from .atonom/scripts/ automatically.
Raw eval returns the chunk’s top-level return value. --transform binds the JSON object as context and appends return transform(context). Do not add a top-level return to a stored transform file that you plan to test with this flag.
--bindings '{"region":"west"}' binds keys as Lua globals. If both bindings and --transform specify context, the transform context wins.
Mock a host call
Save this example assearch-summary.lua in your working folder:
DONE with value: {"ok":true,"count":1}. The CLI consumes the supplied response when the script traps; it does not call a real search tool.
Test no results and a host failure:
{ok:false,error:"forbidden"} as a normal value, so eval still exits 0. The script deliberately handles the failure instead of throwing it.
Result envelopes and multiple calls
Repeat--trap-result once for each call, in execution order. Results are positional, not matched by capability name.
A bare value is wrapped as {"ok":true,"value":...}. An object containing an ok key is treated as a complete host-result envelope. To return application data that itself has an ok field, wrap it explicitly:
--trap-echo answers remaining traps by returning their arguments. Use it for plumbing checks, not as a substitute for realistic fixtures. The default maximum is 16 fulfilled traps; adjust with --max-traps N only when the expected call sequence needs it.
No response, or exceeding the limit, exits 3. Inspect unanswered_trap. After fixing the fixture or script, rerun eval from the beginning. Continuations are intentionally omitted from JSON output.
Test the platform path
For a linked script whose diff has been reviewed:fixtures/order.json with a JSON object, for example {"qty":2,"unit_price":12.5}. --inputs and --inputs-file are mutually exclusive. Missing inputs default to {}.
run --no-save tests whatever is stored at execution time. Coordinate with other editors when exact-version validation matters. Live host capabilities may have side effects; choose appropriate development fixtures and tools.
A useful test checklist
- Normal input produces the expected JSON shape and value.
- Missing fields and wrong types follow the intended error contract.
- Empty collections stay arrays when required.
- Host calls use the expected capability name and argument shape.
- Success, empty results, and host errors are covered.
- Repeated calls terminate and stay within resource limits.
- The stored version passes a platform test after sync.

