MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / extract_description

Function extract_description

openkb/skill/__init__.py:88–102  ·  view source on GitHub ↗

Return the ``description:`` value from a SKILL.md, or ``""``. Missing file, missing frontmatter, or missing field all return the empty string — callers that need to distinguish should check the file themselves first.

(skill_md: Path)

Source from the content-addressed store, hash-verified

86
87
88def extract_description(skill_md: Path) -> str:
89 """Return the ``description:`` value from a SKILL.md, or ``""``.
90
91 Missing file, missing frontmatter, or missing field all return the
92 empty string — callers that need to distinguish should check the file
93 themselves first.
94 """
95 if not skill_md.is_file():
96 return ""
97 text = skill_md.read_text(encoding="utf-8", errors="replace")
98 fm = extract_frontmatter(text)
99 if fm is None:
100 return ""
101 m = _DESC_RE.search(fm)
102 return m.group(1).strip() if m else ""

Callers 1

write_diffFunction · 0.90

Calls 1

extract_frontmatterFunction · 0.85

Tested by

no test coverage detected