MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / parseContextFields

Function parseContextFields

packages/cli/src/commands/preview.ts:330–345  ·  view source on GitHub ↗
(value: string | undefined)

Source from the content-addressed store, hash-verified

328}
329
330function parseContextFields(value: string | undefined): ContextField[] {
331 if (value === undefined) return DEFAULT_CONTEXT_FIELDS;
332 if (!value.trim()) throw new Error("--context-fields cannot be empty");
333 const allowed = new Set<ContextField>(DEFAULT_CONTEXT_FIELDS);
334 const fields = value
335 .split(",")
336 .map((field) => field.trim())
337 .filter(Boolean);
338 const invalid = fields.filter((field) => !allowed.has(field as ContextField));
339 if (invalid.length > 0) {
340 throw new Error(
341 `Unknown context field${invalid.length === 1 ? "" : "s"}: ${invalid.join(", ")}`,
342 );
343 }
344 return [...new Set(fields)] as ContextField[];
345}
346
347function contextIncludes(fields: ContextField[], field: ContextField): boolean {
348 return fields.includes(field);

Callers 1

printCurrentContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected