MCPcopy
hub / github.com/coder/mux / parseDevcontainerStdoutLine

Function parseDevcontainerStdoutLine

src/node/runtime/devcontainerCli.ts:76–100  ·  view source on GitHub ↗
(line: string)

Source from the content-addressed store, hash-verified

74}
75
76export function parseDevcontainerStdoutLine(line: string): DevcontainerStdoutParse | null {
77 const trimmed = line.trim();
78 if (!trimmed) return null;
79 if (!trimmed.startsWith("{")) {
80 return { kind: "raw", text: line };
81 }
82
83 const parsed = parseJsonLine(trimmed);
84 if (!parsed) {
85 return { kind: "raw", text: line };
86 }
87
88 if (isDevcontainerUpResult(parsed)) {
89 return { kind: "result", result: parsed };
90 }
91
92 if (isRecord(parsed)) {
93 const text = extractDevcontainerLogText(parsed);
94 if (text) {
95 return { kind: "log", text };
96 }
97 }
98
99 return null;
100}
101
102export function formatDevcontainerUpError(
103 result: DevcontainerUpResultLine,

Callers 2

runUpFunction · 0.85

Calls 4

parseJsonLineFunction · 0.85
isDevcontainerUpResultFunction · 0.85
isRecordFunction · 0.70

Tested by

no test coverage detected