Repository navigation
v0.9.0
Lifecycle hooks for script orchestration
Summary
Quarry 0.9.0 introduces two new lifecycle hooks — prepare and beforeTerminal — that let scripts intercept the run lifecycle without external wrappers. Scripts can now filter or transform jobs before browser launch, and emit summary data after execution but before the terminal event closes the emit channel.
Highlights
preparehook: transform or skip jobs before browser acquisition — return{ action: 'skip' }to short-circuit a run without launching a browser, or{ action: 'continue', job }to replace the payloadbeforeTerminalhook: outcome-aware hook that fires after script execution with emit still open — useful for emitting summary items, final metadata, or conditional cleanup based on success/failure- Malformed return validation: null, undefined, or structurally invalid
preparereturns produce a diagnostic crash instead of an unhandled TypeError - Contract coverage:
CONTRACT_RUN.mdnow documents the full lifecycle hook execution model;CONTRACT_EMIT.mddocuments reservedskipped/reasonsummary fields - Examples: runnable
hooks-prepareandhooks-before-terminalexamples included - Testing: 31 new tests (24 executor + 7 loader) covering both hooks, edge cases, and ordering guarantees
References
- #174 — Runtime hooks to extend the SDK surface
- #175 — Implementation PR
- Lifecycle Hooks in PUBLIC_API.md
Full Changelog: v0.8.0...v0.9.0