MCPcopy Create free account
hub / github.com/SethGammon/Citadel / parseWorkQueue

Function parseWorkQueue

core/fleet/session.js:60–99  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

58 return String(task.id || '').replace(/^#/, '').trim();
59}
60
61function parseWorkQueue(content) {
62 const lines = String(content || '').split(/\r?\n/);
63 const start = lines.findIndex((line) => /^##\s+Work Queue\s*$/i.test(line.trim()));
64 if (start === -1) return [];
65
66 const tableLines = [];
67 for (let i = start + 1; i < lines.length; i++) {
68 const line = lines[i];
69 if (/^##\s+/.test(line.trim())) break;
70 if (line.trim().startsWith('|')) tableLines.push(line);
71 }
72
73 const headerLine = tableLines.find((line) => !isSeparatorRow(line));
74 if (!headerLine) return [];
75
76 const headers = splitCells(headerLine).map(normalizeHeader);
77 return tableLines
78 .slice(tableLines.indexOf(headerLine) + 1)
79 .filter((line) => !isSeparatorRow(line))
80 .map((line) => {
81 const cells = splitCells(line);
82 const row = {};
83 headers.forEach((header, index) => {
84 row[header] = cells[index] || '';
85 });
86
87 return {
88 id: taskId({ id: row.id }),
89 campaign: row.campaign || '',
90 scope: parseList(row.scope),
91 deps: parseDeps(row.deps),
92 status: normalizeStatus(row.status),
93 wave: parseWave(row.wave),
94 agent: row.agent || '',
95 branch: row.branch || '',
96 evidence: row.evidence || '',
97 };
98 })
99 .filter((task) => task.id);
100}
101
102function formatList(items) {

Callers 3

summarizeSessionFunction · 0.85
collectFunction · 0.85

Calls 7

isSeparatorRowFunction · 0.85
splitCellsFunction · 0.85
taskIdFunction · 0.85
parseListFunction · 0.85
parseDepsFunction · 0.85
parseWaveFunction · 0.85
normalizeStatusFunction · 0.70

Tested by

no test coverage detected