import { array, gte, int, literal, lte, object, optional, record, string, type infer as zodInfer, } from "zod/mini"; export const codeFenceConfigSchema = object({ command: array(string()), infoString: string(), allowExitCode: optional(int().check(gte(0)).check(lte(255))), onMismatchDuringCheck: optional(literal(["error", "warn", "ignore"])), }); export type CodeFenceConfig = zodInfer; export const fileConfigSchema = object({ codeFences: array(codeFenceConfigSchema), }); export type FileConfig = zodInfer; export const repoConfigSchema = object({ $schema: string(), root: literal(["../"]), files: record(string(), fileConfigSchema), }); export type RepoConfig = zodInfer; repoConfigSchema.parse({ $schema: "../schema.json", root: "../", files: { "./README.md": { codeFences: [ { infoString: "text help", command: ["./src/main.ts", "--help"], }, { infoString: "json config example", command: [ "cat", "./examples/json-config/.config/readme-cli-help.json", ], }, ], }, "./README.test.md": { codeFences: [ { infoString: "text help", command: ["./src/main.ts", "--help"], }, ], }, }, });