ShapeLock
contract testing for your AI agent's JSON output shape
npx -y github:Isco0819/shapelockEver run into this?
Like Pact (consumer-driven contract testing, 4k+ GitHub stars) proven for HTTP APIs, but nothing exists for LLM agent outputs. Swap a model, tweak a system prompt, or upgrade an SDK and your agent's JSON shape silently drifts — breaking downstream parsers at 3am with zero warning.
The fix
ShapeLock records a golden output schema from any agent CLI call, then diffs every subsequent run against it — failing CI the moment a required field disappears, a type changes, or a breaking structural shift appears.
What it does
- record golden schema from any command's stdout via `shapelock record <cmd>`
- structural JSON schema diff on every check — flags removed/type-changed fields as errors, new fields as warnings
- CI-friendly exit codes with human-readable colored drift report to stdout
- --ignore flag for volatile fields (timestamps, UUIDs, cursor tokens) to eliminate false positives