Imported from zj6pxpr5hd-creator/automock-ai (
AGENTS.md). Install upstream withnpx skills add zj6pxpr5hd-creator/automock-ai. Copyright stays with the author.
AutoMock AI — guide for coding agents
What this is
A self-hosted API mock + contract-testing server. Input: OpenAPI JSON. Output: stateful mock endpoints.
Map
src/engine/schema.tsOpenAPI ->Route[]($ref/allOf resolution, REST resource inference). Pure.src/engine/generator.tsSeeded fake-data generator from a JSON schema. Pure, deterministic.src/engine/contract.tsvalidate(value, schema)andverifyTarget()(check a real backend vs the spec).src/engine/state.tsSQLiteStore(resources + request_log). Only place that touches the DB.src/engine/mock.tsMockEngine.handle({method,path,body,query,forceStatus})->{status,body,violations}. No HTTP here.src/server.tsHTTP adapter +/__automock/*admin API and dashboard.src/cli.tsserve | routes | verify.test/node:testsuites (*.test.ts). Engine tests callengine.handledirectly.feedback/inbox.jsonlUser feedback, one JSON object per line:{"id","text","source"}.
Commands
npm run verify= typecheck + security lint + all tests. Must be green before you finish.npm testtests only.
Conventions
- TypeScript, Node >= 22.18, ESM, run natively (type stripping): use
import type,.tsextensions in imports, noenum/namespace/ parameter properties. - Zero runtime dependencies. Do not add any.
- Engine functions stay pure and testable; HTTP/SQLite concerns stay in server.ts / state.ts.
- Every behavior change needs a test. Never delete or weaken tests.
violations: string[]in aMockResponseis how problems reach Triage — use it for anything a maintainer should see.
Off limits (enforced by the harness; edits are discarded)
agents/, scripts/, .github/, package.json, package-lock.json, tsconfig.json, this file.
