approval(...) step between two edits, answer it in a terminal, then run the same workflow the way CI and coding agents do. You need Node.js 22.18 or later and Git.
1. A workflow that asks
In a new directorymy-app, create a file to change and the workflow:
src/user.js
workflow.ts
astGrep applies an ast-grep rule to each file. approval(message) waits for a yes or no before the run goes on.
2. Answer in a terminal
y:
n stops the run at the approval, to resume later. Undo the change before the next part: git checkout -- src.
3. Run it unattended
In CI there is nobody to answer. Pass--no-interactive: the run goes as far as it can, saves itself at the approval, and exits.
Exit code
3 lets a CI job tell a waiting run from a finished one. See Exit codes.approval:1 is the question’s id: the approval in step 1. It stays the same however often you resume.
4. Approve and continue
↺ … (done earlier)). Both vars are now const.
To approve everything up front, pass --approve to workflow run. To see past approvals in a dry run, pass --dry-run --approve: a dry run is not saved, so one that reaches an approval without --approve exits 1.
5. Answer from a program
A coding agent or a wrapper script can answer questions while the run waits, in one process. Start the run with--format jsonl --control stdio, read events from its stdout, and write commands to its stdin. Save this as drive.mjs next to my-app:
drive.mjs
reject instead and the run ends as rejected, with exit code 1. The first step’s change stays; a rejected run can’t be resumed without --force.
workflow resume --id <id> --approve approval:1.
Next
- Running in CI and from agents: everything that changes without a person at the terminal.
- Drive codemod from a program: every event and command of
--control stdio.