Replay a recording
Recording a hook captures the full step-by-step input/output of a pipeline so you can replay it offline — useful for regression fixtures, sharing a failure with a teammate, or comparing two builds.
1. Record
ts
import { record, resolveHook } from "@nwire/forge"
import { writeFileSync } from "node:fs"
const hook = resolveHook("posts.publish")
const recording = await record(hook, { title: "hello", body: "world" })
writeFileSync("posts.publish.recording.json", JSON.stringify(recording, null, 2))The JSON contains the entry context, every step's input/output, durations, and any error.
2. Replay
bash
nwire replay posts.publish.recording.jsonOutput is a per-step diff between the recorded run and the current code:
hook: posts.publish
┌──────┬─────────────────────────┬───────────┬──────────┐
│ step │ name │ recorded │ current │
├──────┼─────────────────────────┼───────────┼──────────┤
│ 1 │ validate-input │ ok │ ok │
│ 2 │ check-author │ ok │ ok │
│ 3 │ apply-defaults │ ok │ DIFFER │
│ 4 │ persist │ ok │ ok │
└──────┴─────────────────────────┴───────────┴──────────┘
3 steps match, 1 differs — see ./posts.publish.diff.jsonLive replay endpoint
Until the /_nwire/hooks/replay endpoint ships, nwire replay runs the recording in-process against the local code and diffs against the recorded outputs. Once the endpoint lands, the same CLI will be able to replay against a remote wire.