Skip to content

Commit 0982977

Browse files
committed
fix: Cleanup some strange code in the generated schema
Also fix some fun ESM import things
1 parent 468054e commit 0982977

File tree

4 files changed

+177
-163
lines changed

4 files changed

+177
-163
lines changed

scripts/generate.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,31 @@ async function main() {
4242
const zodSrc = await fs.readFile(zodPath, "utf8");
4343
await fs.writeFile(
4444
zodPath,
45-
updateDocs(zodSrc.replace(`from "zod"`, `from "zod/v4"`)),
45+
updateDocs(
46+
zodSrc
47+
.replace(`from "zod"`, `from "zod/v4"`)
48+
// Weird type issue
49+
.replaceAll(`"McpServerStdio"`, `"stdio"`)
50+
.replaceAll(
51+
"_meta: z.unknown().optional()",
52+
"_meta: z.object().optional()",
53+
),
54+
),
4655
);
4756

4857
const tsPath = "./src/schema/types.gen.ts";
4958
const tsSrc = await fs.readFile(tsPath, "utf8");
5059
await fs.writeFile(
5160
tsPath,
5261
updateDocs(
53-
tsSrc.replace(
54-
`export type ClientOptions`,
55-
`// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype ClientOptions`,
56-
),
62+
tsSrc
63+
.replace(
64+
`export type ClientOptions`,
65+
`// eslint-disable-next-line @typescript-eslint/no-unused-vars\ntype ClientOptions`,
66+
)
67+
// Weird type issue
68+
.replaceAll(`"McpServerStdio"`, `"stdio"`)
69+
.replaceAll(`_meta?: unknown`, `_meta?: { [key: string]: unknown }`),
5770
),
5871
);
5972

src/acp.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { z } from "zod";
2-
import * as schema from "./schema";
2+
import * as schema from "./schema/index.js";
33
import * as validate from "./schema/zod.gen.js";
4-
export * from "./schema";
4+
export type * from "./schema/types.gen.js";
5+
export * from "./schema/index.js";
56
export * from "./stream.js";
67

78
import type { Stream } from "./stream.js";

0 commit comments

Comments
 (0)