MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / readBlockScalar

Function readBlockScalar

src/skill-manager.ts:188–222  ·  view source on GitHub ↗
(
  lines: string[],
  startIndex: number,
  marker: string,
)

Source from the content-addressed store, hash-verified

186}
187
188function readBlockScalar(
189 lines: string[],
190 startIndex: number,
191 marker: string,
192): [string, number] {
193 const blockLines: string[] = [];
194 let index = startIndex;
195
196 while (index < lines.length) {
197 const line = lines[index];
198
199 if (line.trim() === "") {
200 blockLines.push("");
201 index += 1;
202 continue;
203 }
204
205 if (!/^\s/.test(line)) {
206 break;
207 }
208
209 blockLines.push(line);
210 index += 1;
211 }
212
213 const normalized = normalizeBlockIndent(blockLines);
214 const style = marker[0];
215 const chomp = marker.includes("-") ? "strip" : marker.includes("+") ? "keep" : "clip";
216 const value =
217 style === ">"
218 ? foldBlockScalar(normalized)
219 : normalized.join("\n");
220
221 return [applyChomp(value, chomp), index];
222}
223
224function readIndentedScalar(lines: string[], startIndex: number): [string, number] {
225 const blockLines: string[] = [];

Callers 1

readFrontmatterFieldFunction · 0.85

Calls 3

normalizeBlockIndentFunction · 0.85
foldBlockScalarFunction · 0.85
applyChompFunction · 0.85

Tested by

no test coverage detected