MCPcopy Create free account
hub / github.com/apache/maka / pipeOutputLineCount

Function pipeOutputLineCount

packages/cli/src/pi-transcript-tools.ts:231–238  ·  view source on GitHub ↗

* Combined line count for a pipes result. Each stream is counted after * trimming its own trailing newlines and the counts are summed — joining the * streams first would invent a line at the boundary (`out\n` + `err\n` is * two lines, not three).

(output: { stdout?: string; stderr?: string })

Source from the content-addressed store, hash-verified

229 * two lines, not three).
230 */
231function pipeOutputLineCount(output: { stdout?: string; stderr?: string }): number {
232 let count = 0;
233 for (const stream of [output.stdout, output.stderr]) {
234 const trimmed = stream?.replace(/\n+$/, '');
235 if (trimmed) count += trimmed.split('\n').length;
236 }
237 return count;
238}
239
240function compactToolSummary(entry: MakaPiToolEntry): CompactToolSummary | undefined {
241 const result = entry.result;

Callers 2

compactToolSummaryFunction · 0.85
compactTerminalSummaryFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected