* Builds a formatted text document from an Asana task.
(task: AsanaTask)
| 84 | * Builds a formatted text document from an Asana task. |
| 85 | */ |
| 86 | function buildTaskContent(task: AsanaTask): string { |
| 87 | const parts: string[] = [] |
| 88 | |
| 89 | parts.push(task.name || 'Untitled') |
| 90 | |
| 91 | if (task.assignee?.name) parts.push(`Assignee: ${task.assignee.name}`) |
| 92 | |
| 93 | parts.push(`Completed: ${task.completed ? 'Yes' : 'No'}`) |
| 94 | |
| 95 | const tagNames = task.tags?.map((t) => t.name).filter(Boolean) |
| 96 | if (tagNames && tagNames.length > 0) { |
| 97 | parts.push(`Labels: ${tagNames.join(', ')}`) |
| 98 | } |
| 99 | |
| 100 | if (task.notes) { |
| 101 | parts.push('') |
| 102 | parts.push(task.notes) |
| 103 | } |
| 104 | |
| 105 | return parts.join('\n') |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Fetches all project GIDs in a workspace, used when no specific project is configured. |