MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / schemaToYargsOptions

Function schemaToYargsOptions

src/cli/schema-to-yargs.ts:246–263  ·  view source on GitHub ↗
(
  schema: ToolSchemaShape,
  opts: SchemaToYargsOptionsOptions = {},
)

Source from the content-addressed store, hash-verified

244 * Returns a map of flag names (kebab-case) to yargs options.
245 */
246export function schemaToYargsOptions(
247 schema: ToolSchemaShape,
248 opts: SchemaToYargsOptionsOptions = {},
249): Map<string, YargsOptionConfig> {
250 const options = new Map<string, YargsOptionConfig>();
251
252 for (const [key, zodType] of Object.entries(schema)) {
253 const opt = zodToYargsOption(zodType, {
254 hasHydratedDefault: Object.prototype.hasOwnProperty.call(opts.hydratedDefaults ?? {}, key),
255 });
256 if (opt) {
257 const flagName = toKebabCase(key);
258 options.set(flagName, opt);
259 }
260 }
261
262 return options;
263}
264
265/**
266 * Get list of schema keys that couldn't be converted to CLI flags.

Callers 2

registerToolSubcommandFunction · 0.90

Calls 2

toKebabCaseFunction · 0.90
zodToYargsOptionFunction · 0.85

Tested by

no test coverage detected