Catalogue / examples-batch-runner
examples-batch-runner
Older skill: source not recordedSignedDrives a pnpm examples workspace through one automated batch pass. Builds every package and runs the per-package build check first, then launches the example start scripts in parallel with canned answers for interactive prompts, one log file per script, category-based includes and excludes, a standi…--- name: examples-batch-runner description: > Drives a pnpm examples workspace through one automated batch pass. Builds every package and runs the per-package build check first, then launches the example start scripts in parallel with canned answers for interactive prompts, one log file per script, category-based includes and excludes, a standing auto-skip list, and per-script time ceilings. After each pass it checks every clean exit against the example's own source, gathers failures into a rerun list, and retries entries one by one until they pass or persist. Approval auto-answering and stopping a live batch happen only after explicit user confirmation. Use when the user asks to run the whole examples suite, smoke-test the examples workspace, resume or retry an earlier pass, or monitor a long batch. Not for interactively debugging a single example, for examples whose purpose is a real human approval gate, or for suites that depend on live third-party services. ---
Examples Batch Runner
You take a pnpm monorepo's examples workspace through a complete batch pass: build everything, launch the start scripts in parallel with one log each, verify every clean exit against the example's own code, and give the failures a second, sequential chance. Two points in the loop always require a human decision before you act: enabling approval auto-answering, and terminating a live run.
State files
Create these before the first launch and reuse them on every pass:
.tmp/examples-start-logs/— one file per start script, named<package>__<script>.logwith any colon inside the script name replaced by a dash, plus onemain_<timestamp>.logper pass for the runner itself.tmp/examples-batch.pid— process id of a backgrounded pass.tmp/examples-rerun.txt— failures awaiting retry, onepackage:scriptper line
Called with no arguments
If examples-rerun.txt exists and holds at least one entry, go straight to "Retry from the list". Otherwise start at the build gate. This reproduces the helper's default-command rule.
Build gate
Run the workspace build and then the per-package build check before touching any example. Start scripts import compiled output, so a stale or broken build turns a long pass into a pile of fake failures. If either step fails, report the error and stop; never launch a batch against a broken build.
Set the run profile
Interactive prompts are answered from canned inputs by default via auto input mode — that needs no permission. Approval prompts are a different matter and start off:
| Variable | What it silences | Default | |---|---|---| | AUTO_APPROVE_MCP | permission prompts for MCP tool calls | off | | APPLY_PATCH_AUTO_APPROVE | confirmation of file patches | off | | AUTO_APPROVE_HITL | human-in-the-loop checkpoints inside examples | off | | SHELL_AUTO_APPROVE | approval of shell commands the examples run | off |
Show the user this list before the first launch and ask which, if any, to enable for this batch. Turn on only the ones the user explicitly names, prefix them to that one launch command, and never export them into your session, persist them anywhere, or reuse them for anything outside this batch. If the user declines all of them, say plainly that examples containing approval checkpoints may hang until their time ceiling expires, and offer to add those entries to the auto-skip list instead.
Remaining dials:
| Variable | Default | Notes | |---|---|---| | EXAMPLES_CONCURRENCY | 4 | lower to 2 if logs fill with rate-limit errors | | EXAMPLES_EXECA_TIMEOUT_MS | 300000 | per-script ceiling; raise to 600000 on retry for known-slow entries such as long research chains or desktop-automation demos |
Categories decide which starts participate:
| Category | Default | Opt in via | Typical members | |---|---|---|---| | interactive | on | always included | prompt-driven CLI demos | | server | off | EXAMPLES_INCLUDE_SERVER=1 or --include-server | realtime sockets, Next.js and vite apps | | audio | off | EXAMPLES_INCLUDE_AUDIO=1 or --include-audio | voice and realtime-audio demos | | external | off | EXAMPLES_INCLUDE_EXTERNAL=1 | hosted databases, messaging APIs, cloud browser drivers |
Server, audio and external starts stay out by default because they bind ports, open microphones, or reach past this machine.
Keep a standing auto-skip list of exact package:script entries known to hang or to require a real human. Working defaults:
agent-recipes:start:eval-loopagent-recipes:start:dispatchersupport-desk:startintegrations-gallery:startmcp-playground:start:approval-bridgemcp-playground:start:human-relay
Replace the whole list through EXAMPLES_AUTO_SKIP (comma- or space-separated). Auto-skip entries never reach the rerun file.
Launch the batch
Foreground, when you will wait it out:
cd <repo root> EXAMPLES_CONCURRENCY=4 pnpm examples:start-all --include-interactive \ 2>&1 | tee .tmp/examples-start-logs/main_$(date +%Y%m%d-%H%M%S).log
Add only the approval variables the user confirmed, prefixed to this command, and pass through any filters the user asked for (e.g. --filter quickstart, --include-audio). Report the pipeline's exit status when it ends.
Background, when the pass will be long: first read .tmp/examples-batch.pid; if a recorded process id is still alive, refuse to start a second pass and say so. Otherwise run the same pipeline inside a subshell started with &, point the runner at the main log via EXAMPLES_MAIN_LOG, write the subshell's process id to the pid file, and report the id and log path. Do not disown or otherwise detach the run — when your session ends, the children are meant to receive the hangup and exit with it.
While it runs
- Liveness — the pass is active when the pid file exists and its process id is alive; otherwise report "not running".
- Listing — show the contents of the log directory, newest first.
- Following — stream the newest log, or a named one, to watch progress.
Stopping a live pass
Ask the user for explicit confirmation first, every time — never terminate on your own initiative. After a confirmed yes, send the recorded process id the ordinary termination signal, wait about a second, and only if it is still alive follow with the forceful, uncatchable signal; then delete the pid file. If the recorded process is already gone, simply delete the stale pid file — that needs no confirmation.
Read the outcome table
A finished runner prints one row per start — status, package:script, detail (exit code, duration, or skip reason), and log path:
| status | target | detail | log | |---|---|---|---| | pass | hello-quickstart:start | exit 0 in 21s | hello-quickstart__start.log | | fail | docs-chatbot:start | exit 1 in 8s | docs-chatbot__start.log | | skipped | live-voice-demo:start | audio excluded | — |
If the run died before printing the table, rebuild it yourself from the newest main_*.log before doing anything else.
Validate every clean exit
A zero exit proves the process ended, not that the example worked. Immediately after every launch or retry pass, without waiting to be asked:
- Read the example's source and infer its intended flow from the code and comments — which tools it should call, what output or closing message it should emit, which guards should fire.
- Read that example's log in
.tmp/examples-start-logs/. - Set intent against log: tick off each expected action and result; flag omissions, swallowed errors, and divergences such as the wrong tool called or the closing message never emitted.
- Cover all zero-exit entries, never a sample — 44 passes means 44 validations.
- Summarize on the spot; for each verified entry state what you confirmed, e.g. "both tool invocations present, closing summary emitted".
- Quote the exact log lines that justify each conclusion, whole and untruncated — keep commentary short, never the evidence.
Collect the failures
Take the newest main_*.log (or one the user names), and write every row whose status is not a clean pass into examples-rerun.txt as one package:script line per failure. Drop auto-skip entries while collecting, so they never re-enter the loop. This skill does not call the repository's collector module; the step above reproduces its behavior inline.
Retry from the list
Work examples-rerun.txt strictly one entry at a time:
- Split each line at the first colon into package and script. Drop entries matching the auto-skip list.
- Tag the entry by keyword and, if it matches a category that was not opted into — server keywords
realtime,nextjs,server,vite,next; audio keywordsrealtime,voice,audio; external keywordsprisma,redis,twilio,dapr,playwright— leave it in the file and move on without running it. - Otherwise run the script from
examples/<package>with the same profile variables (only the approval variables the user confirmed for this batch), tee output to.tmp/examples-start-logs/<package>__<script>.rerun.log, and continue past failures instead of halting at the first one. - When the list is exhausted, rewrite
examples-rerun.txtwith only the still-failing entries, deduplicated; empty the file entirely if everything passed. Auto-skip entries are never re-added. - Validate every entry that now exits zero, using the full procedure above.
Hard rules
- Do not set any approval-answering variable unless the user confirmed it for this batch, and never let it leak past the single launch command.
- Do not send any signal to the recorded process without the user's explicit go-ahead in this conversation.
- Do not enable the external category alongside confirmed auto-approvals unless the user first confirms the exact list of entries, since that combination means automated calls to outside systems with no human review.
- Do not validate a sample of passes, trim the evidence lines you present, or detach the background run so it outlives your session.
Scope
This skill does not cover interactive debugging of a single example, examples whose whole purpose is exercising a human approval gate, or the source's unconditional approval defaults — those defaults are deliberately replaced here by the per-batch confirmation step above.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 10.4 kB | db9e853368a7 |
| examples.json | 1.8 kB | 7276787ee81d |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 1.0.0 Current | Not recorded | 6 Oct 2026 |
Locking a skill to one version needs Pro.