diff --git a/.github/workflows/ai-triage-campaign.lock.yml b/.github/workflows/ai-triage-campaign.lock.yml index b55a139fe7c..bd4be22f0ff 100644 --- a/.github/workflows/ai-triage-campaign.lock.yml +++ b/.github/workflows/ai-triage-campaign.lock.yml @@ -3188,6 +3188,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3225,37 +3268,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/archie.lock.yml b/.github/workflows/archie.lock.yml index 8b1f59b0b23..3943322a76e 100644 --- a/.github/workflows/archie.lock.yml +++ b/.github/workflows/archie.lock.yml @@ -4260,6 +4260,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4297,37 +4340,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/artifacts-summary.lock.yml b/.github/workflows/artifacts-summary.lock.yml index ff4cc41e11d..7d82106cb4b 100644 --- a/.github/workflows/artifacts-summary.lock.yml +++ b/.github/workflows/artifacts-summary.lock.yml @@ -3086,6 +3086,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3123,37 +3166,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/audit-workflows.lock.yml b/.github/workflows/audit-workflows.lock.yml index b2a91955e3a..043bd9e4c55 100644 --- a/.github/workflows/audit-workflows.lock.yml +++ b/.github/workflows/audit-workflows.lock.yml @@ -4494,6 +4494,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4503,43 +4546,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/blog-auditor.lock.yml b/.github/workflows/blog-auditor.lock.yml index 26ed9b46a80..07b8473e161 100644 --- a/.github/workflows/blog-auditor.lock.yml +++ b/.github/workflows/blog-auditor.lock.yml @@ -3623,6 +3623,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3632,43 +3675,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/brave.lock.yml b/.github/workflows/brave.lock.yml index baf3c9428f8..033ad859df8 100644 --- a/.github/workflows/brave.lock.yml +++ b/.github/workflows/brave.lock.yml @@ -4017,6 +4017,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4054,37 +4097,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/changeset.lock.yml b/.github/workflows/changeset.lock.yml index 93e6225cc71..a7717e0949c 100644 --- a/.github/workflows/changeset.lock.yml +++ b/.github/workflows/changeset.lock.yml @@ -3868,6 +3868,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3905,37 +3948,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/ci-doctor.lock.yml b/.github/workflows/ci-doctor.lock.yml index 030237f3fe9..21b7820ccb6 100644 --- a/.github/workflows/ci-doctor.lock.yml +++ b/.github/workflows/ci-doctor.lock.yml @@ -3542,6 +3542,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3579,37 +3622,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/cli-consistency-checker.lock.yml b/.github/workflows/cli-consistency-checker.lock.yml index 6236f1111b4..6e0986d9c23 100644 --- a/.github/workflows/cli-consistency-checker.lock.yml +++ b/.github/workflows/cli-consistency-checker.lock.yml @@ -3110,6 +3110,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3147,37 +3190,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/cli-version-checker.lock.yml b/.github/workflows/cli-version-checker.lock.yml index 51fe5fdf641..d17a060cd3a 100644 --- a/.github/workflows/cli-version-checker.lock.yml +++ b/.github/workflows/cli-version-checker.lock.yml @@ -3439,6 +3439,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3476,37 +3519,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/cloclo.lock.yml b/.github/workflows/cloclo.lock.yml index 0ac3c235884..6c092d06bf0 100644 --- a/.github/workflows/cloclo.lock.yml +++ b/.github/workflows/cloclo.lock.yml @@ -4704,6 +4704,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4713,43 +4756,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/commit-changes-analyzer.lock.yml b/.github/workflows/commit-changes-analyzer.lock.yml index 900cde509c6..3afe6918ff1 100644 --- a/.github/workflows/commit-changes-analyzer.lock.yml +++ b/.github/workflows/commit-changes-analyzer.lock.yml @@ -3522,6 +3522,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3531,43 +3574,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/copilot-agent-analysis.lock.yml b/.github/workflows/copilot-agent-analysis.lock.yml index 9acb85d2b0a..9b2063d4627 100644 --- a/.github/workflows/copilot-agent-analysis.lock.yml +++ b/.github/workflows/copilot-agent-analysis.lock.yml @@ -4258,6 +4258,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4267,43 +4310,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/copilot-pr-nlp-analysis.lock.yml b/.github/workflows/copilot-pr-nlp-analysis.lock.yml index b5d5d0559f5..8d55c668a34 100644 --- a/.github/workflows/copilot-pr-nlp-analysis.lock.yml +++ b/.github/workflows/copilot-pr-nlp-analysis.lock.yml @@ -4579,6 +4579,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4616,37 +4659,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/copilot-pr-prompt-analysis.lock.yml b/.github/workflows/copilot-pr-prompt-analysis.lock.yml index 05e523ee38e..a364b7715c5 100644 --- a/.github/workflows/copilot-pr-prompt-analysis.lock.yml +++ b/.github/workflows/copilot-pr-prompt-analysis.lock.yml @@ -3748,6 +3748,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3785,37 +3828,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/copilot-session-insights.lock.yml b/.github/workflows/copilot-session-insights.lock.yml index 71d1d3f037f..bf4e7f03487 100644 --- a/.github/workflows/copilot-session-insights.lock.yml +++ b/.github/workflows/copilot-session-insights.lock.yml @@ -5961,6 +5961,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -5970,43 +6013,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/craft.lock.yml b/.github/workflows/craft.lock.yml index 821f368963d..ba90b46ea23 100644 --- a/.github/workflows/craft.lock.yml +++ b/.github/workflows/craft.lock.yml @@ -4319,6 +4319,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4356,37 +4399,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/daily-code-metrics.lock.yml b/.github/workflows/daily-code-metrics.lock.yml index ea4fe7b972b..8db58aa639f 100644 --- a/.github/workflows/daily-code-metrics.lock.yml +++ b/.github/workflows/daily-code-metrics.lock.yml @@ -4655,6 +4655,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4664,43 +4707,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/daily-doc-updater.lock.yml b/.github/workflows/daily-doc-updater.lock.yml index 02fe57801a1..a24962a3b5c 100644 --- a/.github/workflows/daily-doc-updater.lock.yml +++ b/.github/workflows/daily-doc-updater.lock.yml @@ -3305,6 +3305,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3314,43 +3357,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/daily-firewall-report.lock.yml b/.github/workflows/daily-firewall-report.lock.yml index 85e5f461add..e916de2585c 100644 --- a/.github/workflows/daily-firewall-report.lock.yml +++ b/.github/workflows/daily-firewall-report.lock.yml @@ -4076,6 +4076,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4113,37 +4156,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/daily-multi-device-docs-tester.lock.yml b/.github/workflows/daily-multi-device-docs-tester.lock.yml index 248492b828e..79d39802cc4 100644 --- a/.github/workflows/daily-multi-device-docs-tester.lock.yml +++ b/.github/workflows/daily-multi-device-docs-tester.lock.yml @@ -3163,6 +3163,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3172,43 +3215,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/daily-news.lock.yml b/.github/workflows/daily-news.lock.yml index 24015807725..42253165d16 100644 --- a/.github/workflows/daily-news.lock.yml +++ b/.github/workflows/daily-news.lock.yml @@ -4444,6 +4444,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4481,37 +4524,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/daily-repo-chronicle.lock.yml b/.github/workflows/daily-repo-chronicle.lock.yml index 2bb57152b7e..f5769a60933 100644 --- a/.github/workflows/daily-repo-chronicle.lock.yml +++ b/.github/workflows/daily-repo-chronicle.lock.yml @@ -4171,6 +4171,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4208,37 +4251,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/dependabot-go-checker.lock.yml b/.github/workflows/dependabot-go-checker.lock.yml index 015a7b01478..91d89dc060b 100644 --- a/.github/workflows/dependabot-go-checker.lock.yml +++ b/.github/workflows/dependabot-go-checker.lock.yml @@ -3579,6 +3579,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3616,37 +3659,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/dev-hawk.lock.yml b/.github/workflows/dev-hawk.lock.yml index 7e265b62b18..f81179ae1f0 100644 --- a/.github/workflows/dev-hawk.lock.yml +++ b/.github/workflows/dev-hawk.lock.yml @@ -3386,6 +3386,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3423,37 +3466,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/dev.lock.yml b/.github/workflows/dev.lock.yml index 538d8bbb832..cb27d7ac705 100644 --- a/.github/workflows/dev.lock.yml +++ b/.github/workflows/dev.lock.yml @@ -2771,6 +2771,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -2808,37 +2851,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/developer-docs-consolidator.lock.yml b/.github/workflows/developer-docs-consolidator.lock.yml index 6edf32dbc24..565b5b03550 100644 --- a/.github/workflows/developer-docs-consolidator.lock.yml +++ b/.github/workflows/developer-docs-consolidator.lock.yml @@ -4353,6 +4353,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4362,43 +4405,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/dictation-prompt.lock.yml b/.github/workflows/dictation-prompt.lock.yml index 0bc5ff0b8fd..64693207eab 100644 --- a/.github/workflows/dictation-prompt.lock.yml +++ b/.github/workflows/dictation-prompt.lock.yml @@ -3045,6 +3045,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3082,37 +3125,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/docs-noob-tester.lock.yml b/.github/workflows/docs-noob-tester.lock.yml index a862798a749..8cf716cd4b4 100644 --- a/.github/workflows/docs-noob-tester.lock.yml +++ b/.github/workflows/docs-noob-tester.lock.yml @@ -3116,6 +3116,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3153,37 +3196,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/example-permissions-warning.lock.yml b/.github/workflows/example-permissions-warning.lock.yml index 56d6bf1120a..691707605f3 100644 --- a/.github/workflows/example-permissions-warning.lock.yml +++ b/.github/workflows/example-permissions-warning.lock.yml @@ -1131,6 +1131,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -1168,37 +1211,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/example-workflow-analyzer.lock.yml b/.github/workflows/example-workflow-analyzer.lock.yml index 2e05e4053f6..625dc0042cc 100644 --- a/.github/workflows/example-workflow-analyzer.lock.yml +++ b/.github/workflows/example-workflow-analyzer.lock.yml @@ -3102,6 +3102,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3111,43 +3154,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/firewall.lock.yml b/.github/workflows/firewall.lock.yml index 850abfb8d32..e6d2c19e448 100644 --- a/.github/workflows/firewall.lock.yml +++ b/.github/workflows/firewall.lock.yml @@ -1183,6 +1183,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -1220,37 +1263,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/github-mcp-tools-report.lock.yml b/.github/workflows/github-mcp-tools-report.lock.yml index 4e954dfec5b..58a766680de 100644 --- a/.github/workflows/github-mcp-tools-report.lock.yml +++ b/.github/workflows/github-mcp-tools-report.lock.yml @@ -4047,6 +4047,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4056,43 +4099,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/glossary-maintainer.lock.yml b/.github/workflows/glossary-maintainer.lock.yml index eb26832e1a9..06acb3dbfb7 100644 --- a/.github/workflows/glossary-maintainer.lock.yml +++ b/.github/workflows/glossary-maintainer.lock.yml @@ -4117,6 +4117,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4154,37 +4197,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/go-logger.lock.yml b/.github/workflows/go-logger.lock.yml index 1a103fc5944..ce2f3bf2dd6 100644 --- a/.github/workflows/go-logger.lock.yml +++ b/.github/workflows/go-logger.lock.yml @@ -3523,6 +3523,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3532,43 +3575,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/go-pattern-detector.lock.yml b/.github/workflows/go-pattern-detector.lock.yml index 3205dce280c..8b406fa17a1 100644 --- a/.github/workflows/go-pattern-detector.lock.yml +++ b/.github/workflows/go-pattern-detector.lock.yml @@ -3175,6 +3175,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3184,43 +3227,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/grumpy-reviewer.lock.yml b/.github/workflows/grumpy-reviewer.lock.yml index f412cd86404..463f1b57ca3 100644 --- a/.github/workflows/grumpy-reviewer.lock.yml +++ b/.github/workflows/grumpy-reviewer.lock.yml @@ -4096,6 +4096,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4133,37 +4176,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/instructions-janitor.lock.yml b/.github/workflows/instructions-janitor.lock.yml index b347d051d79..c71a62b8790 100644 --- a/.github/workflows/instructions-janitor.lock.yml +++ b/.github/workflows/instructions-janitor.lock.yml @@ -3302,6 +3302,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3311,43 +3354,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/lockfile-stats.lock.yml b/.github/workflows/lockfile-stats.lock.yml index 2afacaeb374..a0f4ea21f97 100644 --- a/.github/workflows/lockfile-stats.lock.yml +++ b/.github/workflows/lockfile-stats.lock.yml @@ -3762,6 +3762,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3771,43 +3814,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/mcp-inspector.lock.yml b/.github/workflows/mcp-inspector.lock.yml index b99dc2c1d3e..9e0434eab54 100644 --- a/.github/workflows/mcp-inspector.lock.yml +++ b/.github/workflows/mcp-inspector.lock.yml @@ -4056,6 +4056,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4093,37 +4136,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/mergefest.lock.yml b/.github/workflows/mergefest.lock.yml index 83c7fa6f0ef..3753920ebad 100644 --- a/.github/workflows/mergefest.lock.yml +++ b/.github/workflows/mergefest.lock.yml @@ -3743,6 +3743,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3780,37 +3823,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/notion-issue-summary.lock.yml b/.github/workflows/notion-issue-summary.lock.yml index 05c984f5dc1..0032e6cc28c 100644 --- a/.github/workflows/notion-issue-summary.lock.yml +++ b/.github/workflows/notion-issue-summary.lock.yml @@ -2791,6 +2791,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -2828,37 +2871,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/pdf-summary.lock.yml b/.github/workflows/pdf-summary.lock.yml index b568ff67920..6cc5db72147 100644 --- a/.github/workflows/pdf-summary.lock.yml +++ b/.github/workflows/pdf-summary.lock.yml @@ -4164,6 +4164,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4201,37 +4244,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/plan.lock.yml b/.github/workflows/plan.lock.yml index 8edb72dfafe..e2cdbc1a316 100644 --- a/.github/workflows/plan.lock.yml +++ b/.github/workflows/plan.lock.yml @@ -3618,6 +3618,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3655,37 +3698,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/poem-bot.lock.yml b/.github/workflows/poem-bot.lock.yml index a1a614c3760..bb3637b7c44 100644 --- a/.github/workflows/poem-bot.lock.yml +++ b/.github/workflows/poem-bot.lock.yml @@ -4335,6 +4335,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4372,37 +4415,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/pr-nitpick-reviewer.lock.yml b/.github/workflows/pr-nitpick-reviewer.lock.yml index 3ccffb39fdc..c85a9fb55df 100644 --- a/.github/workflows/pr-nitpick-reviewer.lock.yml +++ b/.github/workflows/pr-nitpick-reviewer.lock.yml @@ -4460,6 +4460,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4497,37 +4540,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/prompt-clustering-analysis.lock.yml b/.github/workflows/prompt-clustering-analysis.lock.yml index 9ac6f7f824c..2e31c16ca03 100644 --- a/.github/workflows/prompt-clustering-analysis.lock.yml +++ b/.github/workflows/prompt-clustering-analysis.lock.yml @@ -4964,6 +4964,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4973,43 +5016,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/python-data-charts.lock.yml b/.github/workflows/python-data-charts.lock.yml index 3eff3da894b..c95e1ed5fba 100644 --- a/.github/workflows/python-data-charts.lock.yml +++ b/.github/workflows/python-data-charts.lock.yml @@ -4815,6 +4815,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4852,37 +4895,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/q.lock.yml b/.github/workflows/q.lock.yml index 5bf1e707236..1d4d910cdba 100644 --- a/.github/workflows/q.lock.yml +++ b/.github/workflows/q.lock.yml @@ -4736,6 +4736,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4773,37 +4816,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/release-highlights.lock.yml b/.github/workflows/release-highlights.lock.yml index 48f28a77fc0..2db1f287950 100644 --- a/.github/workflows/release-highlights.lock.yml +++ b/.github/workflows/release-highlights.lock.yml @@ -3191,6 +3191,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3228,37 +3271,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/repo-tree-map.lock.yml b/.github/workflows/repo-tree-map.lock.yml index d327f6f6899..b6a1e68b085 100644 --- a/.github/workflows/repo-tree-map.lock.yml +++ b/.github/workflows/repo-tree-map.lock.yml @@ -3125,6 +3125,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3162,37 +3205,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/repository-quality-improver.lock.yml b/.github/workflows/repository-quality-improver.lock.yml index 70282da6548..bcc992614c9 100644 --- a/.github/workflows/repository-quality-improver.lock.yml +++ b/.github/workflows/repository-quality-improver.lock.yml @@ -4064,6 +4064,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4101,37 +4144,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/research.lock.yml b/.github/workflows/research.lock.yml index 784fc2e26f1..5f7c37b22ab 100644 --- a/.github/workflows/research.lock.yml +++ b/.github/workflows/research.lock.yml @@ -2971,6 +2971,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3008,37 +3051,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/safe-output-health.lock.yml b/.github/workflows/safe-output-health.lock.yml index 6eb6fd15ac9..8ed01874c02 100644 --- a/.github/workflows/safe-output-health.lock.yml +++ b/.github/workflows/safe-output-health.lock.yml @@ -3986,6 +3986,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3995,43 +4038,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/schema-consistency-checker.lock.yml b/.github/workflows/schema-consistency-checker.lock.yml index 95bb536c895..a393ac621e9 100644 --- a/.github/workflows/schema-consistency-checker.lock.yml +++ b/.github/workflows/schema-consistency-checker.lock.yml @@ -3772,6 +3772,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3781,43 +3824,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/scout.lock.yml b/.github/workflows/scout.lock.yml index 948ca9b2ac2..429b70ce04e 100644 --- a/.github/workflows/scout.lock.yml +++ b/.github/workflows/scout.lock.yml @@ -4824,6 +4824,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4833,43 +4876,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/security-fix-pr.lock.yml b/.github/workflows/security-fix-pr.lock.yml index e9ea2f6695a..43f6fd56db4 100644 --- a/.github/workflows/security-fix-pr.lock.yml +++ b/.github/workflows/security-fix-pr.lock.yml @@ -3248,6 +3248,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3257,43 +3300,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/semantic-function-refactor.lock.yml b/.github/workflows/semantic-function-refactor.lock.yml index c1a93b7e918..f1b68092eb2 100644 --- a/.github/workflows/semantic-function-refactor.lock.yml +++ b/.github/workflows/semantic-function-refactor.lock.yml @@ -4009,6 +4009,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4018,43 +4061,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index 86ac9d58590..2e0c0846a78 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -3636,6 +3636,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3645,43 +3688,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index 0c2a89d936e..2fb6612af95 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -3238,6 +3238,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3275,37 +3318,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/smoke-detector.lock.yml b/.github/workflows/smoke-detector.lock.yml index 7de714c4317..f9911a4703f 100644 --- a/.github/workflows/smoke-detector.lock.yml +++ b/.github/workflows/smoke-detector.lock.yml @@ -4390,6 +4390,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4399,43 +4442,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/static-analysis-report.lock.yml b/.github/workflows/static-analysis-report.lock.yml index ea8f93f80c3..a2908ee3287 100644 --- a/.github/workflows/static-analysis-report.lock.yml +++ b/.github/workflows/static-analysis-report.lock.yml @@ -3792,6 +3792,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -3801,43 +3844,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/super-linter.lock.yml b/.github/workflows/super-linter.lock.yml index 840b851614d..6aeed3a9140 100644 --- a/.github/workflows/super-linter.lock.yml +++ b/.github/workflows/super-linter.lock.yml @@ -3199,6 +3199,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3236,37 +3279,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/technical-doc-writer.lock.yml b/.github/workflows/technical-doc-writer.lock.yml index c8b5a1b0f1d..66eee5c1c91 100644 --- a/.github/workflows/technical-doc-writer.lock.yml +++ b/.github/workflows/technical-doc-writer.lock.yml @@ -4077,6 +4077,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4114,37 +4157,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-assign-milestone-allowed.lock.yml b/.github/workflows/test-assign-milestone-allowed.lock.yml index 5ad710feb91..8efa5b167dc 100644 --- a/.github/workflows/test-assign-milestone-allowed.lock.yml +++ b/.github/workflows/test-assign-milestone-allowed.lock.yml @@ -2889,6 +2889,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -2898,43 +2941,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/test-claude-assign-milestone.lock.yml b/.github/workflows/test-claude-assign-milestone.lock.yml index 4285fc6c536..7183220b2c6 100644 --- a/.github/workflows/test-claude-assign-milestone.lock.yml +++ b/.github/workflows/test-claude-assign-milestone.lock.yml @@ -2877,6 +2877,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -2886,43 +2929,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/test-claude-oauth-workflow.lock.yml b/.github/workflows/test-claude-oauth-workflow.lock.yml index aa6d8d7417c..e844a83dba2 100644 --- a/.github/workflows/test-claude-oauth-workflow.lock.yml +++ b/.github/workflows/test-claude-oauth-workflow.lock.yml @@ -1271,6 +1271,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -1280,43 +1323,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/test-close-discussion.lock.yml b/.github/workflows/test-close-discussion.lock.yml index 46309cf476a..fb0759b4576 100644 --- a/.github/workflows/test-close-discussion.lock.yml +++ b/.github/workflows/test-close-discussion.lock.yml @@ -2762,6 +2762,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -2799,37 +2842,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-copilot-assign-milestone.lock.yml b/.github/workflows/test-copilot-assign-milestone.lock.yml index 2df7ce4966e..7d955e95af6 100644 --- a/.github/workflows/test-copilot-assign-milestone.lock.yml +++ b/.github/workflows/test-copilot-assign-milestone.lock.yml @@ -2725,6 +2725,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -2762,37 +2805,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-jqschema.lock.yml b/.github/workflows/test-jqschema.lock.yml index f9566e13a93..958cf916d1a 100644 --- a/.github/workflows/test-jqschema.lock.yml +++ b/.github/workflows/test-jqschema.lock.yml @@ -1316,6 +1316,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -1353,37 +1396,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-manual-approval.lock.yml b/.github/workflows/test-manual-approval.lock.yml index c6952e6b39b..fbe0ce09b96 100644 --- a/.github/workflows/test-manual-approval.lock.yml +++ b/.github/workflows/test-manual-approval.lock.yml @@ -1125,6 +1125,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -1162,37 +1205,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-ollama-threat-detection.lock.yml b/.github/workflows/test-ollama-threat-detection.lock.yml index b2b056690e6..02cf15961c3 100644 --- a/.github/workflows/test-ollama-threat-detection.lock.yml +++ b/.github/workflows/test-ollama-threat-detection.lock.yml @@ -2735,6 +2735,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -2772,37 +2815,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-post-steps.lock.yml b/.github/workflows/test-post-steps.lock.yml index 10e4a8ba692..118ead57dc8 100644 --- a/.github/workflows/test-post-steps.lock.yml +++ b/.github/workflows/test-post-steps.lock.yml @@ -1128,6 +1128,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -1165,37 +1208,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-secret-masking.lock.yml b/.github/workflows/test-secret-masking.lock.yml index bb3ea8b88ca..17bb153b7f5 100644 --- a/.github/workflows/test-secret-masking.lock.yml +++ b/.github/workflows/test-secret-masking.lock.yml @@ -1138,6 +1138,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -1175,37 +1218,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/test-svelte.lock.yml b/.github/workflows/test-svelte.lock.yml index 8cb0d8759c8..aa4c86e380d 100644 --- a/.github/workflows/test-svelte.lock.yml +++ b/.github/workflows/test-svelte.lock.yml @@ -1176,6 +1176,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -1213,37 +1256,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/tidy.lock.yml b/.github/workflows/tidy.lock.yml index 6190c6baca4..a0087c4c0e5 100644 --- a/.github/workflows/tidy.lock.yml +++ b/.github/workflows/tidy.lock.yml @@ -3329,6 +3329,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3366,37 +3409,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/typist.lock.yml b/.github/workflows/typist.lock.yml index 42bd93406a4..4b14775aa03 100644 --- a/.github/workflows/typist.lock.yml +++ b/.github/workflows/typist.lock.yml @@ -4067,6 +4067,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4076,43 +4119,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/unbloat-docs.lock.yml b/.github/workflows/unbloat-docs.lock.yml index 89b641be79a..b6cf39a25dc 100644 --- a/.github/workflows/unbloat-docs.lock.yml +++ b/.github/workflows/unbloat-docs.lock.yml @@ -4477,6 +4477,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseClaudeLog, @@ -4486,43 +4529,8 @@ jobs: } function parseClaudeLog(logContent) { try { - let logEntries; - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } - } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + const logEntries = parseLogEntries(logContent); + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/.github/workflows/video-analyzer.lock.yml b/.github/workflows/video-analyzer.lock.yml index 53ac5265d3b..98f6d5370c2 100644 --- a/.github/workflows/video-analyzer.lock.yml +++ b/.github/workflows/video-analyzer.lock.yml @@ -3285,6 +3285,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -3322,37 +3365,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/.github/workflows/weekly-issue-summary.lock.yml b/.github/workflows/weekly-issue-summary.lock.yml index 4128250b0b2..077ef40601e 100644 --- a/.github/workflows/weekly-issue-summary.lock.yml +++ b/.github/workflows/weekly-issue-summary.lock.yml @@ -4034,6 +4034,49 @@ jobs: return `${summary}\n\n`; } } + function parseLogEntries(logContent) { + let logEntries; + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + logEntries = []; + const lines = logContent.split("\n"); + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; + } + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + continue; + } + } + if (!trimmedLine.startsWith("{")) { + continue; + } + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + continue; + } + } + } + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + return logEntries; + } function main() { runLogParser({ parseLog: parseCopilotLog, @@ -4071,37 +4114,10 @@ jobs: if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - logEntries = []; - const lines = logContent.split("\n"); - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; - } - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - continue; - } - } - if (!trimmedLine.startsWith("{")) { - continue; - } - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - continue; - } - } + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; } const conversationResult = generateConversationMarkdown(logEntries, { diff --git a/pkg/workflow/js/log_parser_shared.cjs b/pkg/workflow/js/log_parser_shared.cjs index 0580f260a7f..43929f3bf43 100644 --- a/pkg/workflow/js/log_parser_shared.cjs +++ b/pkg/workflow/js/log_parser_shared.cjs @@ -567,6 +567,72 @@ function formatToolUse(toolUse, toolResult, options = {}) { } } +/** + * Parses log content as JSON array or JSONL format + * Handles multiple formats: JSON array, JSONL, and mixed format with debug logs + * @param {string} logContent - The raw log content as a string + * @returns {Array|null} Array of parsed log entries, or null if parsing fails + */ +function parseLogEntries(logContent) { + let logEntries; + + // First, try to parse as JSON array (old format) + try { + logEntries = JSON.parse(logContent); + if (!Array.isArray(logEntries)) { + throw new Error("Not a JSON array"); + } + return logEntries; + } catch (jsonArrayError) { + // If that fails, try to parse as JSONL format (mixed format with debug logs) + logEntries = []; + const lines = logContent.split("\n"); + + for (const line of lines) { + const trimmedLine = line.trim(); + if (trimmedLine === "") { + continue; // Skip empty lines + } + + // Handle lines that start with [ (JSON array format) + if (trimmedLine.startsWith("[{")) { + try { + const arrayEntries = JSON.parse(trimmedLine); + if (Array.isArray(arrayEntries)) { + logEntries.push(...arrayEntries); + continue; + } + } catch (arrayParseError) { + // Skip invalid array lines + continue; + } + } + + // Skip debug log lines that don't start with { + // (these are typically timestamped debug messages) + if (!trimmedLine.startsWith("{")) { + continue; + } + + // Try to parse each line as JSON + try { + const jsonEntry = JSON.parse(trimmedLine); + logEntries.push(jsonEntry); + } catch (jsonLineError) { + // Skip invalid JSON lines (could be partial debug output) + continue; + } + } + } + + // Return null if we couldn't parse anything + if (!Array.isArray(logEntries) || logEntries.length === 0) { + return null; + } + + return logEntries; +} + // Export functions module.exports = { formatDuration, @@ -579,4 +645,5 @@ module.exports = { formatMcpParameters, formatInitializationSummary, formatToolUse, + parseLogEntries, }; diff --git a/pkg/workflow/js/log_parser_shared.test.cjs b/pkg/workflow/js/log_parser_shared.test.cjs index 1078caefe5e..4d52a1de3ae 100644 --- a/pkg/workflow/js/log_parser_shared.test.cjs +++ b/pkg/workflow/js/log_parser_shared.test.cjs @@ -586,6 +586,143 @@ describe("log_parser_shared.cjs", () => { }); }); + describe("parseLogEntries", () => { + it("should parse JSON array format", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = JSON.stringify([ + { type: "system", subtype: "init" }, + { type: "assistant", message: { content: [{ type: "text", text: "Hello" }] } }, + ]); + + const result = parseLogEntries(logContent); + + expect(result).toHaveLength(2); + expect(result[0].type).toBe("system"); + expect(result[1].type).toBe("assistant"); + }); + + it("should parse JSONL format (newline-separated JSON objects)", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = [ + '{"type": "system", "subtype": "init"}', + '{"type": "assistant", "message": {"content": []}}', + '{"type": "result", "num_turns": 1}', + ].join("\n"); + + const result = parseLogEntries(logContent); + + expect(result).toHaveLength(3); + expect(result[0].type).toBe("system"); + expect(result[1].type).toBe("assistant"); + expect(result[2].type).toBe("result"); + }); + + it("should handle mixed format with debug logs", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = [ + "2024-01-01T12:00:00.000Z [DEBUG] Starting...", + '{"type": "system", "subtype": "init"}', + "2024-01-01T12:00:01.000Z [INFO] Processing...", + '{"type": "assistant", "message": {"content": []}}', + ].join("\n"); + + const result = parseLogEntries(logContent); + + expect(result).toHaveLength(2); + expect(result[0].type).toBe("system"); + expect(result[1].type).toBe("assistant"); + }); + + it("should parse JSON array embedded in a line", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = '[{"type": "system", "subtype": "init"}, {"type": "assistant", "message": {"content": []}}]'; + + const result = parseLogEntries(logContent); + + expect(result).toHaveLength(2); + expect(result[0].type).toBe("system"); + expect(result[1].type).toBe("assistant"); + }); + + it("should handle lines starting with array notation", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = [ + "Some debug output", + '[{"type": "system", "subtype": "init"}]', + '[{"type": "assistant", "message": {"content": []}}]', + ].join("\n"); + + const result = parseLogEntries(logContent); + + expect(result).toHaveLength(2); + expect(result[0].type).toBe("system"); + expect(result[1].type).toBe("assistant"); + }); + + it("should skip empty lines", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = ['{"type": "system", "subtype": "init"}', "", " ", '{"type": "assistant", "message": {"content": []}}'].join( + "\n" + ); + + const result = parseLogEntries(logContent); + + expect(result).toHaveLength(2); + }); + + it("should skip invalid JSON lines", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = [ + '{"type": "system", "subtype": "init"}', + '{"invalid json here', + '{"type": "assistant", "message": {"content": []}}', + ].join("\n"); + + const result = parseLogEntries(logContent); + + expect(result).toHaveLength(2); + expect(result[0].type).toBe("system"); + expect(result[1].type).toBe("assistant"); + }); + + it("should return null for unrecognized formats", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = "Just plain text with no JSON"; + + const result = parseLogEntries(logContent); + + expect(result).toBeNull(); + }); + + it("should return null for empty content", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const result = parseLogEntries(""); + + expect(result).toBeNull(); + }); + + it("should handle content that is not a JSON array", async () => { + const { parseLogEntries } = await import("./log_parser_shared.cjs"); + + const logContent = '{"type": "single-object"}'; + + const result = parseLogEntries(logContent); + + // Should fall back to JSONL parsing + expect(result).toHaveLength(1); + expect(result[0].type).toBe("single-object"); + }); + }); + describe("formatToolUse", () => { it("should format Bash tool use", async () => { const { formatToolUse } = await import("./log_parser_shared.cjs"); diff --git a/pkg/workflow/js/parse_claude_log.cjs b/pkg/workflow/js/parse_claude_log.cjs index efb4a704ce9..16591c87ac6 100644 --- a/pkg/workflow/js/parse_claude_log.cjs +++ b/pkg/workflow/js/parse_claude_log.cjs @@ -13,6 +13,7 @@ const { formatMcpParameters, formatInitializationSummary, formatToolUse, + parseLogEntries, } = require("./log_parser_shared.cjs"); function main() { @@ -30,57 +31,10 @@ function main() { */ function parseClaudeLog(logContent) { try { - let logEntries; + // Use shared parseLogEntries function + const logEntries = parseLogEntries(logContent); - // First, try to parse as JSON array (old format) - try { - logEntries = JSON.parse(logContent); - if (!Array.isArray(logEntries)) { - throw new Error("Not a JSON array"); - } - } catch (jsonArrayError) { - // If that fails, try to parse as mixed format (debug logs + JSONL) - logEntries = []; - const lines = logContent.split("\n"); - - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; // Skip empty lines - } - - // Handle lines that start with [ (JSON array format) - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - // Skip invalid array lines - continue; - } - } - - // Skip debug log lines that don't start with { - // (these are typically timestamped debug messages) - if (!trimmedLine.startsWith("{")) { - continue; - } - - // Try to parse each line as JSON - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - // Skip invalid JSON lines (could be partial debug output) - continue; - } - } - } - - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return { markdown: "## Agent Log Summary\n\nLog format not recognized as Claude JSON array or JSONL.\n", mcpFailures: [], diff --git a/pkg/workflow/js/parse_copilot_log.cjs b/pkg/workflow/js/parse_copilot_log.cjs index 32aa5872eea..fcbad6de6d5 100644 --- a/pkg/workflow/js/parse_copilot_log.cjs +++ b/pkg/workflow/js/parse_copilot_log.cjs @@ -13,6 +13,7 @@ const { formatMcpParameters, formatInitializationSummary, formatToolUse, + parseLogEntries, } = require("./log_parser_shared.cjs"); function main() { @@ -72,48 +73,12 @@ function parseCopilotLog(logContent) { if (debugLogEntries && debugLogEntries.length > 0) { logEntries = debugLogEntries; } else { - // Try JSONL format - logEntries = []; - const lines = logContent.split("\n"); - - for (const line of lines) { - const trimmedLine = line.trim(); - if (trimmedLine === "") { - continue; // Skip empty lines - } - - // Handle lines that start with [ (JSON array format) - if (trimmedLine.startsWith("[{")) { - try { - const arrayEntries = JSON.parse(trimmedLine); - if (Array.isArray(arrayEntries)) { - logEntries.push(...arrayEntries); - continue; - } - } catch (arrayParseError) { - // Skip invalid array lines - continue; - } - } - - // Skip debug log lines that don't start with { - if (!trimmedLine.startsWith("{")) { - continue; - } - - // Try to parse each line as JSON - try { - const jsonEntry = JSON.parse(trimmedLine); - logEntries.push(jsonEntry); - } catch (jsonLineError) { - // Skip invalid JSON lines - continue; - } - } + // Try JSONL format using shared function + logEntries = parseLogEntries(logContent); } } - if (!Array.isArray(logEntries) || logEntries.length === 0) { + if (!logEntries) { return "## Agent Log Summary\n\nLog format not recognized as Copilot JSON array or JSONL.\n"; }