MCPcopy
hub / github.com/github/awesome-copilot / buildBoardState

Function buildBoardState

extensions/backlog-swipe-triage/extension.mjs:298–337  ·  view source on GitHub ↗
(board)

Source from the content-addressed store, hash-verified

296}
297
298function buildBoardState(board) {
299 const allLabels = [...new Set(board.items.flatMap((item) => (Array.isArray(item.labels) ? item.labels : [])))].sort((a, b) =>
300 a.localeCompare(b),
301 );
302 const hasUnassigned = board.items.some((item) => !Array.isArray(item.assignees) || item.assignees.length === 0);
303 const allAssignees = [
304 ...new Set(board.items.flatMap((item) => (Array.isArray(item.assignees) ? item.assignees : []))),
305 ].sort((a, b) => a.localeCompare(b));
306 if (hasUnassigned) {
307 allAssignees.unshift("unassigned");
308 }
309 const pending = [];
310 const resolved = [];
311 for (const item of board.items) {
312 const itemWithStatus = { ...item, workStatus: buildItemWorkStatus(board, item) };
313 const result = board.decisions[item.id];
314 if (result) {
315 resolved.push({ ...itemWithStatus, result });
316 } else {
317 pending.push(itemWithStatus);
318 }
319 }
320 return {
321 boardId: board.id,
322 title: board.title,
323 repo: normalizeText(board.repo),
324 syncedAt: normalizeText(board.syncedAt),
325 filters: normalizeFilters(board.filters, defaultFilters),
326 availableLabels: allLabels,
327 availableAssignees: allAssignees,
328 pending,
329 resolved,
330 decisionCounts: resolved.reduce((counts, item) => {
331 const key = item.result.decision;
332 counts[key] = (counts[key] || 0) + 1;
333 return counts;
334 }, {}),
335 updatedAt: board.updatedAt,
336 };
337}
338
339function buildIssueDetails(issue) {
340 const parts = [];

Callers 2

handleServerRequestFunction · 0.85
extension.mjsFile · 0.85

Calls 3

buildItemWorkStatusFunction · 0.85
normalizeFiltersFunction · 0.85
normalizeTextFunction · 0.70

Tested by

no test coverage detected