Help us shape the future of Go! Take the 2026 Go Developer Survey

replay

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package replay replays captured agent hook payloads (testdata/hooks) through the real hook dispatcher and compares what graphmaster answers with golden files. The non-test code here only loads fixtures, expands their placeholders and normalizes output; the scenarios live in the package tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Environ

func Environ(rec *hookrun.Recording, vars map[string]string) ([]string, error)

Environ returns the fixture's env snapshot (placeholders expanded) in os.Environ form, sorted by name.

func Expand

func Expand(s string, vars map[string]string) (string, error)

Expand replaces every {{NAME}} in s with vars[NAME]. A placeholder without a value is an error, so a typo in a fixture cannot silently reach the dispatcher.

func ExpandJSON

func ExpandJSON(raw []byte, vars map[string]string) ([]byte, error)

ExpandJSON is Expand for JSON text: values are escaped as JSON string content, which keeps Windows paths and quotes valid inside the payload.

func Fields

func Fields(stdout []byte) []string

Fields flattens a JSON object into "path: value" lines (sorted by path) so multi-line strings such as deny reasons read naturally in a golden file. Non-object input yields nil.

func HooksDir

func HooksDir() string

HooksDir returns the absolute path of testdata/hooks.

func Load

func Load(rel string) (*hookrun.Recording, error)

Load reads one fixture. rel is relative to HooksDir, for example "claude/real-session-start-1.json".

func Normalize

func Normalize(s string, scrub *hookrun.Scrubber) string

Normalize makes hook output comparable across runs: machine paths become {{REPO}} / {{HOME}} and timings become placeholders.

func Placeholders

func Placeholders(s string) []string

Placeholders returns the sorted distinct placeholder names in s.

func Stdin

func Stdin(rec *hookrun.Recording, vars map[string]string) ([]byte, error)

Stdin returns the fixture's payload with placeholders expanded.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL