* Builds a formatted text document from a Linear issue.
(issue: Record<string, unknown>)
| 72 | * Builds a formatted text document from a Linear issue. |
| 73 | */ |
| 74 | function buildIssueContent(issue: Record<string, unknown>): string { |
| 75 | const parts: string[] = [] |
| 76 | |
| 77 | const identifier = issue.identifier as string | undefined |
| 78 | const title = (issue.title as string) || 'Untitled' |
| 79 | parts.push(`${identifier ? `${identifier}: ` : ''}${title}`) |
| 80 | |
| 81 | const state = issue.state as Record<string, unknown> | undefined |
| 82 | if (state?.name) parts.push(`Status: ${state.name}`) |
| 83 | |
| 84 | const priority = issue.priorityLabel as string | undefined |
| 85 | if (priority) parts.push(`Priority: ${priority}`) |
| 86 | |
| 87 | const assignee = issue.assignee as Record<string, unknown> | undefined |
| 88 | if (assignee?.name) parts.push(`Assignee: ${assignee.name}`) |
| 89 | |
| 90 | const labelsConn = issue.labels as Record<string, unknown> | undefined |
| 91 | const labelNodes = (labelsConn?.nodes || []) as Record<string, unknown>[] |
| 92 | if (labelNodes.length > 0) { |
| 93 | parts.push(`Labels: ${labelNodes.map((l) => l.name as string).join(', ')}`) |
| 94 | } |
| 95 | |
| 96 | const description = issue.description as string | undefined |
| 97 | if (description) { |
| 98 | parts.push('') |
| 99 | parts.push(markdownToPlainText(description)) |
| 100 | } |
| 101 | |
| 102 | return parts.join('\n') |
| 103 | } |
| 104 | |
| 105 | const ISSUE_FIELDS = ` |
| 106 | id |
no test coverage detected