MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / normalizeConfigField

Function normalizeConfigField

src/pkg/utils/skill.ts:6–17  ·  view source on GitHub ↗
(raw: Record<string, unknown>)

Source from the content-addressed store, hash-verified

4
5// 校验并规范化单个 config 字段
6function normalizeConfigField(raw: Record<string, unknown>): SkillConfigField {
7 const type = (raw.type as string) || "text";
8 const field: SkillConfigField = {
9 title: String(raw.title || ""),
10 type: type as SkillConfigField["type"],
11 };
12 if (raw.secret === true) field.secret = true;
13 if (raw.required === true) field.required = true;
14 if (raw.default !== undefined) field.default = raw.default;
15 if (Array.isArray(raw.values)) field.values = raw.values.map(String);
16 return field;
17}
18
19// 解析 SKILL.cat.md 内容:YAML frontmatter + markdown body
20export function parseSkillMd(content: string): { metadata: SkillMetadata; prompt: string } | null {

Callers 1

parseSkillMdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected