MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseJsonOutput

Function parseJsonOutput

scripts/agent-config-smoke.ts:76–81  ·  view source on GitHub ↗
(result: CliResult)

Source from the content-addressed store, hash-verified

74};
75
76const parseJsonOutput = <T>(result: CliResult): T => {
77 const start = result.stdout.indexOf("{");
78 const end = result.stdout.lastIndexOf("}");
79 assert(start >= 0 && end > start, `CLI output did not contain JSON:\n${result.text}`);
80 return JSON.parse(result.stdout.slice(start, end + 1)) as T;
81};
82
83const toolData = <T>(value: unknown): T => {
84 const result = value as { readonly ok?: boolean; readonly data?: T; readonly error?: unknown };

Callers 3

createSecretPlaceholderFunction · 0.85
runSmokeFunction · 0.85

Calls 1

assertFunction · 0.85

Tested by

no test coverage detected