feat: if rules
This commit is contained in:
parent
d6b9dcb4d3
commit
d0e922dad4
1 changed files with 9 additions and 1 deletions
|
|
@ -28,6 +28,12 @@ const docSchema = z.object({
|
|||
faviconUrl: z.string().optional(),
|
||||
});
|
||||
|
||||
const ruleObjectSchema = z.object({
|
||||
name: z.string(),
|
||||
rule: z.string(),
|
||||
if: z.string().optional(),
|
||||
});
|
||||
|
||||
export const blockItemWrapperSchema = <T extends z.AnyZodObject>(schema: T) =>
|
||||
z.object({
|
||||
uses: z.string(),
|
||||
|
|
@ -95,7 +101,9 @@ export const blockSchema = baseConfigYamlSchema.and(
|
|||
z.object({ context: z.array(contextSchema).length(1) }),
|
||||
z.object({ data: z.array(dataSchema).length(1) }),
|
||||
z.object({ mcpServers: z.array(mcpServerSchema).length(1) }),
|
||||
z.object({ rules: z.array(z.string()).length(1) }),
|
||||
z.object({
|
||||
rules: z.array(z.union([z.string(), ruleObjectSchema])).length(1),
|
||||
}),
|
||||
z.object({ prompts: z.array(promptSchema).length(1) }),
|
||||
z.object({ docs: z.array(docSchema).length(1) }),
|
||||
]),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue