MCPcopy Create free account
hub / github.com/cortexkit/magic-context / extractRecentErrors

Function extractRecentErrors

packages/cli/src/lib/issue-body.ts:78–88  ·  view source on GitHub ↗
(sanitized: string, limit = 20)

Source from the content-addressed store, hash-verified

76 * into a separate section that the body-cap is careful not to drop.
77 */
78export function extractRecentErrors(sanitized: string, limit = 20): string[] {
79 const matches: string[] = [];
80 const lines = sanitized.split(/\r?\n/);
81 // Walk newest-first, stop once we hit `limit`.
82 for (let i = lines.length - 1; i >= 0 && matches.length < limit; i -= 1) {
83 if (isErrorLogLine(lines[i])) {
84 matches.push(lines[i]);
85 }
86 }
87 return matches.reverse();
88}
89
90/**
91 * Apply a byte budget to a rendered issue body. If the body is already

Callers 3

bundleIssueReportFunction · 0.90
issue-body.test.tsFile · 0.90
bundleIssueReportFunction · 0.90

Calls 1

isErrorLogLineFunction · 0.85

Tested by

no test coverage detected