MCPcopy
hub / github.com/garrytan/gstack / extractFrontmatter

Function extractFrontmatter

lib/gstack-memory-helpers.ts:350–355  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

348}
349
350function extractFrontmatter(content: string): string | null {
351 // Supports both `---\n...\n---` (YAML) and `+++\n...\n+++` (TOML, rare).
352 const yamlMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n/);
353 if (yamlMatch) return yamlMatch[1];
354 return null;
355}
356
357function extractGbrainBlock(frontmatter: string): GbrainManifest | null {
358 // Naive YAML extraction — finds the `gbrain:` key and parses its sub-tree.

Callers 1

parseSkillManifestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected