v2: codemod iterations, canonical zod schema exports from sdk-shared (#2354)

Co-authored-by: Felix Weinberger <fweinberger@anthropic.com>
This commit is contained in:
Konstantin Konstantinov 2026-06-25 21:42:44 +03:00 • committed by GitHub
commit 0fb8406d83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,7 +12,7 @@ const PROJECT_ROOT = join(__dirname, '..');
* - `2025-11-25`: the frozen, released schema.
* - `2026-07-28`: the upcoming protocol revision.
*
* Each is written to `packages/core/src/types/spec.types.<version>.ts`.
* Each is written to `packages/core-internal/src/types/spec.types.<version>.ts`.
*/
const SUPPORTED_VERSIONS = ['2025-11-25', '2026-07-28'] as const;
type SpecVersion = (typeof SUPPORTED_VERSIONS)[number];
@ -90,13 +90,13 @@ async function updateSpecTypes(version: SpecVersion, providedSHA?: string): Prom
const fullContent = header + specContent;
// Format with prettier using the project's config so the output passes lint
const outputPath = join(PROJECT_ROOT, 'packages', 'core', 'src', 'types', `spec.types.${version}.ts`);
const outputPath = join(PROJECT_ROOT, 'packages', 'core-internal', 'src', 'types', `spec.types.${version}.ts`);
const prettierConfig = await prettier.resolveConfig(outputPath);
const formatted = await prettier.format(fullContent, { ...prettierConfig, filepath: outputPath });
writeFileSync(outputPath, formatted, 'utf-8');
console.log(`[${version}] Successfully updated packages/core/src/types/spec.types.${version}.ts`);
console.log(`[${version}] Successfully updated packages/core-internal/src/types/spec.types.${version}.ts`);
}
function isSupportedVersion(value: string): value is SpecVersion {