MCPcopy Create free account
hub / github.com/Fibi66/FeiControl / extractFirstParagraph

Function extractFirstParagraph

src/lib/skill-parser.ts:80–110  ·  view source on GitHub ↗

* Extract first paragraph as description if no front matter description

(body: string)

Source from the content-addressed store, hash-verified

78 * Extract first paragraph as description if no front matter description
79 */
80function extractFirstParagraph(body: string): string {
81 const lines = body.split('\n');
82 let inParagraph = false;
83 let paragraph = '';
84
85 for (const line of lines) {
86 const trimmed = line.trim();
87
88 if (trimmed.startsWith('#')) {
89 if (inParagraph) break;
90 continue;
91 }
92
93 if (!trimmed && !inParagraph) continue;
94
95 if (trimmed && !inParagraph) {
96 inParagraph = true;
97 paragraph = trimmed;
98 continue;
99 }
100
101 if (trimmed && inParagraph) {
102 paragraph += ' ' + trimmed;
103 continue;
104 }
105
106 if (!trimmed && inParagraph) break;
107 }
108
109 return paragraph || 'No description available';
110}
111
112/**
113 * Count files in a skill folder (excluding hidden files)

Callers 1

parseSkillFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected