MCPcopy Create free account
hub / github.com/backnotprop/plannotator / parseLastJson

Function parseLastJson

apps/opencode-plugin/cli-bridge.ts:154–162  ·  view source on GitHub ↗
(stdout: string)

Source from the content-addressed store, hash-verified

152}
153
154function parseLastJson<T>(stdout: string): T {
155 const lines = stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
156 for (let i = lines.length - 1; i >= 0; i--) {
157 const line = lines[i];
158 if (!line.startsWith("{")) continue;
159 return JSON.parse(line) as T;
160 }
161 throw new Error("Plannotator CLI did not return JSON.");
162}
163
164export function buildCliBridgeEnv(
165 bridge: OpenCodeBridgeContext | undefined,

Callers 2

runCliPlanReviewFunction · 0.85
handleCliCommandFunction · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected