docs(readme): document page eval-js and its output contract - #73
Conversation
eval-js was missing from the Page Actions list entirely. Add it, plus a short section on what it prints: the evaluated value alone on stdout (objects and arrays as JSON, a JS null as null) with the status line on stderr, so it captures with $(...) and pipes into jq. Also note that console.log is discarded, failures exit non-zero with the real JavaScript error, and -o json returns the full execution result. Both examples were run verbatim against a live session. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| README.md | Adds useful eval-js documentation, but overgeneralizes the non-zero failure contract to JSON mode and adds no automated contract coverage. |
Comments Outside Diff (1)
-
README.md, line 169-170 (link)Clarify JSON failure exit behavior
The non-zero exit guarantee applies to text mode, while
-o jsonreturns the full envelope before checkingsuccessand therefore exits zero for JavaScript failures. Without this distinction, shell automation can rely on the documented exit status and treat asuccess:falseresult as successful.Knowledge Base Used:
Prompt To Fix With AI
This is a comment left during a code review. Path: README.md Line: 169-170 Comment: **Clarify JSON failure exit behavior** The non-zero exit guarantee applies to text mode, while `-o json` returns the full envelope before checking `success` and therefore exits zero for JavaScript failures. Without this distinction, shell automation can rely on the documented exit status and treat a `success:false` result as successful. **Knowledge Base Used:** - [Output, validation, and errors](https://app.greptile.com/nottelabs/-/custom-context/knowledge-base/nottelabs/notte-cli/-/docs/output-validation-and-errors.md) - [CLI runtime experience](https://app.greptile.com/nottelabs/-/custom-context/knowledge-base/nottelabs/notte-cli/-/docs/runtime-experience.md) --- For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Prompt To Fix All With AI
### Issue 1
README.md:169-170
**Clarify JSON failure exit behavior**
The non-zero exit guarantee applies to text mode, while `-o json` returns the full envelope before checking `success` and therefore exits zero for JavaScript failures. Without this distinction, shell automation can rely on the documented exit status and treat a `success:false` result as successful.
### Issue 2
README.md:160-170
**Add output contract coverage**
This change documents concrete guarantees for serialization, stream separation, discarded logging, and failure handling without adding an automated test. A focused integration test would prevent these shell-facing guarantees from drifting unnoticed.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "docs(readme): document page eval-js and ..." | Re-trigger Greptile
Why
page eval-jswas missing from the README's Page Actions list entirely — the command existed but was never documented there. And after #72 its output is worth explaining: the evaluated value now prints alone on stdout with the status line on stderr, which makes it composable in a shell.What
notte page eval-jsto the Page Actions command list.nullasnull), status on stderr,console.logdiscarded, failures exit non-zero with the actual JavaScript error,-o jsonfor the full execution result — with the two shapes users actually want:Verification
Both examples were run verbatim against a live staging session with a CLI built from main: the capture returned
Example Domain, the jq pipe returned a count.🤖 Generated with Claude Code