浏览代码

docs(command): restore zod async comments

Kit Langton 1 月之前
父节点
当前提交
addc33212b
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      packages/opencode/src/command/index.ts

+ 3 - 0
packages/opencode/src/command/index.ts

@@ -38,6 +38,8 @@ export namespace Command {
       agent: z.string().optional(),
       model: z.string().optional(),
       source: z.enum(["command", "mcp", "skill"]).optional(),
+      // workaround for zod not supporting async functions natively so we use getters
+      // https://zod.dev/v4/changelog?id=zfunction
       template: z.promise(z.string()).or(z.string()),
       subtask: z.boolean().optional(),
       hints: z.array(z.string()),
@@ -46,6 +48,7 @@ export namespace Command {
       ref: "Command",
     })
 
+  // for some reason zod is inferring `string` for z.promise(z.string()).or(z.string()) so we have to manually override it
   export type Info = Omit<z.infer<typeof Info>, "template"> & { template: Promise<string> | string }
 
   export function hints(template: string) {