Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

sync-provider-models.ts

601 lines21.4 KB

1/**
2 * Syncs modelschemas catalogs into native provider model-meta.ts files.
3 *
4 * For each synced provider, this script:
5 * 1. Lists that provider's models from modelschemas (`@modelschemas/client`)
6 * 2. Uses native limits, modalities, pricing, and capabilities. Fills any
7 * field the native row left empty from the modelschemas OpenRouter catalog
8 * 3. Identifies models missing from the provider's model-meta.ts
9 * 4. Generates and inserts new model constants, array entries, and type map entries
10 *
11 * Usage:
12 * pnpm tsx scripts/sync-provider-models.ts
13 *
14 * Optional: MODELSCHEMAS_API_KEY raises the modelschemas rate limit.
15 *
16 * ## Providers deliberately NOT synced
17 *
18 * - **fal** — 1k+ model-grained endpoints; image field maps have their own
19 * generator (`scripts/generate-fal-image-field-map.ts`).
20 * - **elevenlabs** — id arrays, not ModelMeta constants; see
21 * `scripts/sync-elevenlabs-models.ts`.
22 * - **bedrock** — ids are AWS-region-qualified; see
23 * `scripts/fetch-bedrock-models.ts`.
24 * - **ollama**, **llmgateway**, **vercel-gateway**, **lovable** — different
25 * catalogs (local, aggregator, or their own fetch scripts).
26 * - **claude-code**, **codex**, **opencode**, **grok-build** — harness aliases.
27 * BytePlus video/image duration and size tables stay hand-curated.
28 */
29​
30import { execFileSync } from 'node:child_process'
31import { readFile, readdir, writeFile } from 'node:fs/promises'
32import { dirname, resolve } from 'node:path'
33import { fileURLToPath } from 'node:url'
34import {
35 alreadySynced,
36 outputsText,
37 pricingLines,
38 selectNativeInserts,
39} from './model-sync/catalog'
40import type { CatalogModel, SyncModel } from './model-sync/catalog'
41import { toModelConstName } from './model-sync/ids'
42import {
43 applyChatModelCatalogInserts,
44 insertConstants,
45} from './model-sync/native-insert'
46import { createSyncClient, fetchSyncCatalogs } from './model-sync/modelschemas'
47import {
48 buildAnthropicProviderOptionsType,
49 buildProviderSupportsBody,
50} from './model-sync/provider-supports'
51import type { ArrayRef } from './model-sync/native-insert'
52import type { SyncedProvider } from './model-sync/provider-supports'
53​
54const __dirname = dirname(fileURLToPath(import.meta.url))
55const ROOT = resolve(__dirname, '..')
56​
57/** Seconds in 30 days — models older than this before the last sync are skipped */
58const MAX_MODEL_AGE_SECONDS = 30 * 24 * 60 * 60
59const LAST_RUN_FILE = resolve(ROOT, 'scripts/.sync-models-last-run')
60​
61interface ProviderConfig {
62 packageName: string
63 metaFile: string
64 /** How array entries reference the constant, e.g. '.name' or '.id' */
65 arrayRef: ArrayRef
66 /** Which field name is used for context window size */
67 contextField: 'context_window' | 'max_input_tokens'
68 /** Name of the exported chat model array */
69 chatArrayName: string
70 /** Name of the provider options type map */
71 providerOptionsTypeName: string
72 /** Name of the input modalities type map */
73 inputModalitiesTypeName: string
74 /**
75 * Name of the per-model tool-capabilities type map. Missing this lets
76 * `ResolveToolCapabilities` fall back to `readonly []` and every provider
77 * tool stops type-checking on the new model.
78 */
79 toolCapabilitiesTypeName?: string
80 /**
81 * Name of the runtime `Record<string, number>` mapping model id →
82 * `max_output_tokens`, if the provider maintains one. Anthropic uses this to
83 * default the required `max_tokens` request field to the model's real ceiling
84 * (issue #849); other providers treat token limits as optional and omit it.
85 */
86 maxOutputTokensMapName?: string
87 /**
88 * Runtime set of models that accept tools plus `output_config.format` in
89 * one request. New Anthropic ids are inserted here. `-fast` variants stay
90 * out: fast mode is a request parameter, not a model id, and the model-meta
91 * test expects every registered model in the set.
92 */
93 combinedToolsAndSchemaSetName?: string
94 /** Valid input modality types for this provider's ModelMeta interface */
95 validInputModalities: Array<InputModality>
96 /** The satisfies type clause (after 'as const satisfies') */
97 referenceSatisfies: string
98 /** The type string for provider options map entries */
99 referenceProviderOptionsEntry: string
100 /** Whether this provider has both name AND id fields */
101 hasBothNameAndId: boolean
102 /** Whether the provider options type is a mapped type (skip insertion) */
103 providerOptionsIsMappedType: boolean
104 /** Raw-id prefixes to always skip */
105 skipPatterns: Array<string>
106 /** Activities to insert. `null` means the catalog left activity unset. */
107 acceptedActivities: Array<string | null>
108 /** See `NativeInsertRules.requireOpenRouterEnrich`. */
109 requireOpenRouterEnrich: boolean
110 /**
111 * Write a `pricing` block. An unknown side is left out, never written as
112 * 0, so Groq/Mistral can insert with `pricing: {}`. BytePlus has none.
113 */
114 includePricing: boolean
115 outputTokenField: 'max_output_tokens' | 'max_completion_tokens'
117​
118const PROVIDER_MAP: Record<SyncedProvider, ProviderConfig> = {
119 openai: {
120 packageName: '@tanstack/ai-openai',
121 metaFile: resolve(ROOT, 'packages/ai-openai/src/model-meta.ts'),
122 arrayRef: '.name',
123 contextField: 'context_window',
124 chatArrayName: 'OPENAI_CHAT_MODELS',
125 providerOptionsTypeName: 'OpenAIChatModelProviderOptionsByName',
126 inputModalitiesTypeName: 'OpenAIModelInputModalitiesByName',
127 toolCapabilitiesTypeName: 'OpenAIChatModelToolCapabilitiesByName',
128 validInputModalities: ['text', 'image', 'audio', 'video'],
129 referenceSatisfies:
130 'ModelMeta<OpenAIBaseOptions & OpenAIStructuredOutputOptions & OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions>',
131 referenceProviderOptionsEntry:
132 'OpenAIBaseOptions & OpenAIStructuredOutputOptions & OpenAIToolsOptions & OpenAIStreamingOptions & OpenAIMetadataOptions',
133 hasBothNameAndId: false,
134 providerOptionsIsMappedType: false,
135 skipPatterns: [
136 'gpt-3.5-', // Legacy GPT-3.5 models
137 'gpt-4-', // Legacy GPT-4 base models (not 4.1+)
138 'gpt-4o', // GPT-4o variants (4o, 4o-mini, 4o-audio, etc.)
139 'gpt-oss-', // Open-source/experimental models
140 'chatgpt-', // ChatGPT branded models
141 ],
142 acceptedActivities: ['chat'],
143 requireOpenRouterEnrich: true,
144 includePricing: true,
145 outputTokenField: 'max_output_tokens',
146 },
147 anthropic: {
148 packageName: '@tanstack/ai-anthropic',
149 metaFile: resolve(ROOT, 'packages/ai-anthropic/src/model-meta.ts'),
150 arrayRef: '.id',
151 contextField: 'context_window',
152 chatArrayName: 'ANTHROPIC_MODELS',
153 providerOptionsTypeName: 'AnthropicChatModelProviderOptionsByName',
154 inputModalitiesTypeName: 'AnthropicModelInputModalitiesByName',
155 toolCapabilitiesTypeName: 'AnthropicChatModelToolCapabilitiesByName',
156 maxOutputTokensMapName: 'ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS',
157 combinedToolsAndSchemaSetName: 'ANTHROPIC_COMBINED_TOOLS_AND_SCHEMA_MODELS',
158 validInputModalities: ['text', 'image', 'audio', 'video', 'document'],
159 referenceSatisfies:
160 'ModelMeta<AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicToolChoiceOptions & AnthropicSamplingOptions>',
161 referenceProviderOptionsEntry:
162 'AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicToolChoiceOptions & AnthropicSamplingOptions',
163 hasBothNameAndId: true,
164 providerOptionsIsMappedType: false,
165 skipPatterns: [],
166 acceptedActivities: ['chat'],
167 requireOpenRouterEnrich: true,
168 includePricing: true,
169 outputTokenField: 'max_output_tokens',
170 },
171 gemini: {
172 packageName: '@tanstack/ai-gemini',
173 metaFile: resolve(ROOT, 'packages/ai-gemini/src/model-meta.ts'),
174 arrayRef: '.name',
175 contextField: 'max_input_tokens',
176 chatArrayName: 'GEMINI_MODELS',
177 providerOptionsTypeName: 'GeminiChatModelProviderOptionsByName',
178 inputModalitiesTypeName: 'GeminiModelInputModalitiesByName',
179 toolCapabilitiesTypeName: 'GeminiChatModelToolCapabilitiesByName',
180 validInputModalities: ['text', 'image', 'audio', 'video', 'document'],
181 referenceSatisfies:
182 'ModelMeta<GeminiToolConfigOptions & GeminiSafetyOptions & GeminiCommonConfigOptions & GeminiCachedContentOptions & GeminiStructuredOutputOptions>',
183 referenceProviderOptionsEntry:
184 'GeminiToolConfigOptions & GeminiSafetyOptions & GeminiCommonConfigOptions & GeminiCachedContentOptions & GeminiStructuredOutputOptions',
185 hasBothNameAndId: false,
186 providerOptionsIsMappedType: false,
187 skipPatterns: [
188 'gemma-', // Gemma open-source models (not Gemini API models)
189 ],
190 acceptedActivities: ['chat'],
191 requireOpenRouterEnrich: true,
192 includePricing: true,
193 outputTokenField: 'max_output_tokens',
194 },
195 grok: {
196 packageName: '@tanstack/ai-grok',
197 metaFile: resolve(ROOT, 'packages/ai-grok/src/model-meta.ts'),
198 arrayRef: '.name',
199 contextField: 'context_window',
200 chatArrayName: 'GROK_CHAT_MODELS',
201 providerOptionsTypeName: 'GrokChatModelProviderOptionsByName',
202 inputModalitiesTypeName: 'GrokModelInputModalitiesByName',
203 toolCapabilitiesTypeName: 'GrokChatModelToolCapabilitiesByName',
204 validInputModalities: ['text', 'image', 'audio', 'video', 'document'],
205 referenceSatisfies: 'ModelMeta',
206 referenceProviderOptionsEntry: 'GrokProviderOptions',
207 hasBothNameAndId: false,
208 providerOptionsIsMappedType: true,
209 skipPatterns: [],
210 acceptedActivities: ['chat'],
211 requireOpenRouterEnrich: true,
212 includePricing: true,
213 outputTokenField: 'max_output_tokens',
214 },
215 groq: {
216 packageName: '@tanstack/ai-groq',
217 metaFile: resolve(ROOT, 'packages/ai-groq/src/model-meta.ts'),
218 arrayRef: '.name',
219 contextField: 'context_window',
220 chatArrayName: 'GROQ_CHAT_MODELS',
221 providerOptionsTypeName: 'GroqChatModelProviderOptionsByName',
222 inputModalitiesTypeName: 'GroqModelInputModalitiesByName',
223 toolCapabilitiesTypeName: 'GroqChatModelToolCapabilitiesByName',
224 validInputModalities: ['text', 'image', 'audio'],
225 referenceSatisfies: 'ModelMeta<GroqTextProviderOptions>',
226 referenceProviderOptionsEntry: 'GroqTextProviderOptions',
227 hasBothNameAndId: false,
228 providerOptionsIsMappedType: true,
229 skipPatterns: ['whisper-', 'canopylabs/'],
230 acceptedActivities: [null, 'chat'],
231 requireOpenRouterEnrich: false,
232 includePricing: true,
233 outputTokenField: 'max_completion_tokens',
234 },
235 mistral: {
236 packageName: '@tanstack/ai-mistral',
237 metaFile: resolve(ROOT, 'packages/ai-mistral/src/model-meta.ts'),
238 arrayRef: '.name',
239 contextField: 'context_window',
240 chatArrayName: 'MISTRAL_CHAT_MODELS',
241 providerOptionsTypeName: 'MistralChatModelProviderOptionsByName',
242 inputModalitiesTypeName: 'MistralModelInputModalitiesByName',
243 validInputModalities: ['text', 'image', 'audio', 'document'],
244 referenceSatisfies: 'ModelMeta<MistralTextProviderOptions>',
245 referenceProviderOptionsEntry: 'MistralTextProviderOptions',
246 hasBothNameAndId: false,
247 providerOptionsIsMappedType: false,
248 skipPatterns: [
249 'mistral-embed',
250 'codestral-embed',
251 'mistral-ocr',
252 'mistral-moderation',
253 'voxtral-',
254 'mistral-vibe',
255 'mistral-code-fim',
256 'mistral-code-',
257 'glm-',
258 'zai-',
259 ],
260 acceptedActivities: [null, 'chat'],
261 requireOpenRouterEnrich: false,
262 includePricing: true,
263 outputTokenField: 'max_completion_tokens',
264 },
265 byteplus: {
266 packageName: '@tanstack/ai-byteplus',
267 metaFile: resolve(ROOT, 'packages/ai-byteplus/src/model-meta.ts'),
268 arrayRef: '.name',
269 contextField: 'context_window',
270 chatArrayName: 'BYTEPLUS_CHAT_MODELS',
271 providerOptionsTypeName: 'BytePlusChatModelProviderOptionsByName',
272 inputModalitiesTypeName: 'BytePlusModelInputModalitiesByName',
273 validInputModalities: ['text', 'image', 'audio', 'video', 'document'],
274 referenceSatisfies: 'ModelMeta',
275 referenceProviderOptionsEntry: 'BytePlusTextProviderOptions',
276 hasBothNameAndId: false,
277 providerOptionsIsMappedType: true,
278 skipPatterns: [],
279 acceptedActivities: ['chat'],
280 requireOpenRouterEnrich: false,
281 includePricing: false,
282 outputTokenField: 'max_output_tokens',
283 },
285​
286type InputModality = 'text' | 'image' | 'audio' | 'video' | 'document'
287​
288const MODALITY_MAP: Record<string, InputModality> = {
289 text: 'text',
290 image: 'image',
291 audio: 'audio',
292 video: 'video',
293 file: 'document',
294 document: 'document',
296​
297function mapInputModalities(modalities: Array<string>): Array<InputModality> {
298 const mapped = modalities
299 .map((m) => MODALITY_MAP[m.toLowerCase()])
300 .filter((m): m is InputModality => m !== undefined)
301 if (!mapped.includes('text')) {
302 mapped.unshift('text')
303 }
304 return mapped
306​
307function anthropicOptionsType(model: SyncModel): string {
308 return buildAnthropicProviderOptionsType({
309 supportedParameters: model.supportedParameters,
310 // modelschemas has no cache price, and every current Claude model
311 // supports prompt caching.
312 hasCachedPricing: true,
313 })
315​
316function providerOptionsEntryFor(
317 model: SyncModel,
318 provider: SyncedProvider,
319 config: ProviderConfig,
320): string {
321 if (provider === 'anthropic') return anthropicOptionsType(model)
322 return config.referenceProviderOptionsEntry
324​
325function satisfiesClause(
326 model: SyncModel,
327 provider: SyncedProvider,
328 config: ProviderConfig,
329): string {
330 if (provider === 'anthropic') {
331 return `ModelMeta<${anthropicOptionsType(model)}>`
332 }
333 return config.referenceSatisfies
335​
336function extractExistingModelIds(content: string): Set<string> {
337 return new Set(
338 Array.from(content.matchAll(/^\s+(?:name|id):\s*'([^']+)'/gm), (m) =>
339 m[1]!.replaceAll('.', '-'),
340 ),
341 )
343​
344function extractExistingConstNames(content: string): Set<string> {
345 return new Set(
346 Array.from(
347 content.matchAll(/^const\s+([A-Z][A-Z0-9_]+)\s*=/gm),
348 (m) => m[1]!,
349 ),
350 )
352​
353async function readLastRunTimestamp(): Promise<number | null> {
354 let content: string
355 try {
356 content = await readFile(LAST_RUN_FILE, 'utf-8')
357 } catch (error) {
358 // First run. Any other read error must not silently reset the cutoff.
359 if (isNodeError(error) && error.code === 'ENOENT') return null
360 throw error
361 }
362 const ts = parseInt(content.trim(), 10)
363 if (isNaN(ts)) throw new Error(`${LAST_RUN_FILE} is not a timestamp`)
364 return ts
366​
367function isNodeError(error: unknown): error is NodeJS.ErrnoException {
368 return error instanceof Error && 'code' in error
370​
371async function writeLastRunTimestamp(): Promise<void> {
372 const now = Math.floor(Date.now() / 1000)
373 await writeFile(LAST_RUN_FILE, String(now) + '\n', 'utf-8')
375​
376function generateModelConstant(
377 model: SyncModel,
378 provider: SyncedProvider,
379 config: ProviderConfig,
380): string {
381 const constName = toModelConstName(model.nativeId)
382​
383 const inputModalities = mapInputModalities(model.inputModalities).filter(
384 (m) => config.validInputModalities.includes(m),
385 )
386​
387 const lines: Array<string> = []
388 lines.push(`const ${constName} = {`)
389 lines.push(` name: '${model.nativeId}',`)
390 if (config.hasBothNameAndId) {
391 lines.push(` id: '${model.nativeId}',`)
392 }
393 if (isPositive(model.contextWindow)) {
394 lines.push(
395 ` ${config.contextField}: ${formatNumber(model.contextWindow)},`,
396 )
397 }
398 if (isPositive(model.maxOutput)) {
399 lines.push(
400 ` ${config.outputTokenField}: ${formatNumber(model.maxOutput)},`,
401 )
402 }
403 lines.push(` supports: {`)
404 lines.push(
405 buildProviderSupportsBody({
406 provider,
407 inputModalities,
408 outputModalities: model.outputModalities,
409 supportedParameters: model.supportedParameters,
410 reasoningMandatory: model.reasoningMandatory,
411 }),
412 )
413 lines.push(` },`)
414 if (config.includePricing) {
415 lines.push(...pricingLines(model.pricing))
416 }
417 lines.push(`} as const satisfies ${satisfiesClause(model, provider, config)}`)
418 return lines.join('\n')
420​
421function isPositive(n: number | null): n is number {
422 return n != null && n > 0
424​
425/** 1048576 → 1_048_576 */
426function formatNumber(n: number): string {
427 return n.toLocaleString('en-US').replaceAll(',', '_')
429​
430/** Packages the fetch scripts changed, so the changeset covers them too. */
431function detectChangedPackages(): Set<string> {
432 const diff = execFileSync(
433 'git',
434 ['diff', 'HEAD', '--name-only', '--', 'packages/'],
435 { encoding: 'utf-8', cwd: ROOT },
436 )
437 const changed = new Set<string>()
438 for (const match of diff.matchAll(/^packages\/([\w-]+)\//gm)) {
439 changed.add(`@tanstack/${match[1]}`)
440 }
441 return changed
443​
444async function syncModelMeta(
445 provider: SyncedProvider,
446 config: ProviderConfig,
447 catalogs: {
448 native: Record<SyncedProvider, Array<CatalogModel>>
449 openrouter: Array<CatalogModel>
450 },
451 cutoffTimestamp: number,
452): Promise<{ added: number; heldBack: number }> {
453 console.log(`\nProcessing provider: ${provider}`)
454 const rows = catalogs.native[provider]
455 console.log(` Found ${rows.length} modelschemas models for '${provider}'`)
456​
457 let content = await readFile(config.metaFile, 'utf-8')
458 const existingIds = extractExistingModelIds(content)
459 const existingConstNames = extractExistingConstNames(content)
460 console.log(
461 ` Existing models in file: ${existingIds.size} IDs, ${existingConstNames.size} constants`,
462 )
463​
464 const { inserts, heldBack, skipped } = selectNativeInserts(
465 rows,
466 { ...config, provider, cutoffTimestamp },
467 catalogs.openrouter,
468 (nativeId) => alreadySynced(nativeId, existingIds, existingConstNames),
469 )
470 const skipCounts = Object.entries(skipped)
471 .map(([reason, count]) => `${reason}=${count}`)
472 .join(', ')
473 if (skipCounts) console.log(` Skipped: ${skipCounts}`)
474 for (const rawId of heldBack) {
475 console.log(` Waiting for an OpenRouter price: ${rawId}`)
476 }
477​
478 if (inserts.length === 0) {
479 console.log(' No new models to add.')
480 return { added: 0, heldBack: heldBack.length }
481 }
482​
483 console.log(` Adding ${inserts.length} new models:`)
484 for (const { model } of inserts) {
485 console.log(` - ${model.nativeId} (${toModelConstName(model.nativeId)})`)
486 }
487​
488 content = insertConstants(
489 content,
490 inserts.map(({ model }) => generateModelConstant(model, provider, config)),
491 )
492 content = applyChatModelCatalogInserts(
493 content,
494 config,
495 inserts
496 .filter(({ model, activity }) => outputsText(model, activity))
497 .map(({ model }) => ({
498 constName: toModelConstName(model.nativeId),
499 providerOptionsEntry: providerOptionsEntryFor(model, provider, config),
500 hasMaxOutputTokens: isPositive(model.maxOutput),
501 acceptsCombinedToolsAndSchema: !model.nativeId.endsWith('-fast'),
502 })),
503 )
504​
505 await writeFile(config.metaFile, content, 'utf-8')
506 console.log(` Wrote updated file: ${config.metaFile}`)
507 return { added: inserts.length, heldBack: heldBack.length }
509​
510async function main() {
511 const lastRun = await readLastRunTimestamp()
512 const now = Math.floor(Date.now() / 1000)
513 const cutoffTimestamp = (lastRun ?? now) - MAX_MODEL_AGE_SECONDS
514 const cutoffDate = new Date(cutoffTimestamp * 1000)
515 .toISOString()
516 .split('T')[0]
517 console.log(
518 `Model age cutoff: ${cutoffDate} (skipping models created before this date)`,
519 )
520​
521 const catalogs = await fetchSyncCatalogs(createSyncClient())
522 const counts = Object.entries(catalogs.native)
523 .map(([id, rows]) => `${id}=${rows.length}`)
524 .join(', ')
525 console.log(
526 `Fetched modelschemas catalogs: ${counts}, openrouter=${catalogs.openrouter.length}`,
527 )
528​
529 const changedPackages = new Set<string>()
530 let totalAdded = 0
531 let totalHeldBack = 0
532 for (const [provider, config] of Object.entries(PROVIDER_MAP) as Array<
533 [SyncedProvider, ProviderConfig]
534 >) {
535 const { added, heldBack } = await syncModelMeta(
536 provider,
537 config,
538 catalogs,
539 cutoffTimestamp,
540 )
541 totalAdded += added
542 totalHeldBack += heldBack
543 if (added > 0) changedPackages.add(config.packageName)
544 }
545​
546 console.log(`\nDone. Added ${totalAdded} new models total.`)
547​
548 // Held-back ids still age out after 30 days. Freezing the timestamp
549 // instead would stall it for good on ids OpenRouter never prices (Live
550 // API models), so each run names them in its log.
551 if (totalHeldBack > 0) {
552 console.log(
553 `${totalHeldBack} models are waiting for an OpenRouter price (listed above).`,
554 )
555 }
556 await writeLastRunTimestamp()
557​
558 const allChangedPackages = detectChangedPackages()
559 for (const pkg of changedPackages) {
560 allChangedPackages.add(pkg)
561 }
562​
563 if (allChangedPackages.size > 0) {
564 await createChangeset(allChangedPackages)
565 }
567​
568async function createChangeset(changedPackages: Set<string>) {
569 const changesetDir = resolve(ROOT, '.changeset')
570 const existing = (await readdir(changesetDir)).find(
571 (f) => f.startsWith('sync-models') && f.endsWith('.md'),
572 )
573 const changesetPath = resolve(changesetDir, existing ?? 'sync-models.md')
574 if (existing) {
575 const existingContent = await readFile(changesetPath, 'utf-8')
576 for (const match of existingContent.matchAll(/'([^']+)':\s*patch/g)) {
577 changedPackages.add(match[1]!)
578 }
579 }
580 await writeFile(
581 changesetPath,
582 buildChangesetContent(changedPackages),
583 'utf-8',
584 )
585 console.log(
586 `\nChangeset ${existing ? 'updated' : 'created'}: ${changesetPath}`,
587 )
588 console.log(` Packages: ${Array.from(changedPackages).sort().join(', ')}`)
590function buildChangesetContent(packages: Set<string>): string {
591 const packageLines = Array.from(packages)
592 .sort()
593 .map((pkg) => `'${pkg}': patch`)
594 .join('\n')
595 return `---\n${packageLines}\n---\n\nUpdate model metadata from modelschemas\n`
597​
598main().catch((err) => {
599 console.error(err)
600 process.exit(1)
601})