MCPcopy Index your code
hub / github.com/codeaashu/claude-code / extractFirstFrame

Function extractFirstFrame

src/utils/staticRender.tsx:62–69  ·  view source on GitHub ↗

* Extracts content from the first complete frame in Ink's output. * Ink with non-TTY stdout outputs multiple frames, each wrapped in DEC synchronized * update sequences ([?2026h ... [?2026l). We only want the first frame's content.

(output: string)

Source from the content-addressed store, hash-verified

60 * update sequences ([?2026h ... [?2026l). We only want the first frame's content.
61 */
62function extractFirstFrame(output: string): string {
63 const startIndex = output.indexOf(SYNC_START);
64 if (startIndex === -1) return output;
65 const contentStart = startIndex + SYNC_START.length;
66 const endIndex = output.indexOf(SYNC_END, contentStart);
67 if (endIndex === -1) return output;
68 return output.slice(contentStart, endIndex);
69}
70
71/**
72 * Renders a React node to a string with ANSI escape codes (for terminal output).

Callers 1

renderToAnsiStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected