-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathrunner-config.ts
More file actions
41 lines (34 loc) · 1.52 KB
/
runner-config.ts
File metadata and controls
41 lines (34 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { z } from 'zod/v4';
import { auditOutputsSchema } from './audit-output.js';
import { convertAsyncZodFunctionToSchema } from './implementation/function.js';
import { filePathSchema } from './implementation/schemas.js';
import { persistConfigSchema } from './persist-config.js';
export const outputTransformSchema = convertAsyncZodFunctionToSchema(
z.function({
input: [z.unknown()],
output: z.union([auditOutputsSchema, z.promise(auditOutputsSchema)]),
}),
);
export type OutputTransform = z.infer<typeof outputTransformSchema>;
export const runnerConfigSchema = z
.object({
command: z.string().describe('Shell command to execute'),
args: z.array(z.string()).describe('Command arguments').optional(),
outputFile: filePathSchema.describe('Runner output path'),
outputTransform: outputTransformSchema.optional(),
configFile: filePathSchema.describe('Runner config path').optional(),
})
.describe('How to execute runner');
export type RunnerConfig = z.infer<typeof runnerConfigSchema>;
export const runnerFunctionSchema = convertAsyncZodFunctionToSchema(
z.function({
input: [persistConfigSchema],
output: z.union([auditOutputsSchema, z.promise(auditOutputsSchema)]),
}),
);
export type RunnerFunction = z.infer<typeof runnerFunctionSchema>;
export const runnerFilesPathsSchema = z.object({
runnerConfigPath: filePathSchema.describe('Runner config path'),
runnerOutputPath: filePathSchema.describe('Runner output path'),
});
export type RunnerFilesPaths = z.infer<typeof runnerFilesPathsSchema>;