Files
orca/src/shared/linear-project-list-format.ts
T
Trevin ChowandJinjing 2b8d9a43de feat(linear): add project support to agent CLI (#5433)
* feat(linear): add project support to agent CLI

* fix(linear): resolve project names across search pages

* fix(linear): harden agent project support

* fix(linear): address project review feedback

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
2026-06-15 18:24:53 -07:00

36 lines
1.3 KiB
TypeScript

import type { LinearProjectListResult } from './linear-agent-result-types'
// Why: non-JSON project output aligns ids with the existing compact Linear tables.
const LINEAR_PROJECT_NAME_COLUMN_WIDTH = 28
export function formatLinearProjectListRows(result: LinearProjectListResult): string {
if (result.projects.length === 0) {
return 'No Linear projects found.'
}
return result.projects
.map((project) => {
const teams =
project.teams
?.map((team) => {
const key = team.key?.trim()
return key ? key : team.name
})
.filter(Boolean)
.join(',') || 'no-teams'
const workspace = project.workspaceName ? ` ${project.workspaceName}` : ''
return `${project.name.padEnd(LINEAR_PROJECT_NAME_COLUMN_WIDTH)} ${project.id} ${teams}${workspace}`
})
.join('\n')
}
export function linearProjectListWarningLines(result: LinearProjectListResult): string[] {
const warnings: string[] = []
if (result.meta.hasMore) {
warnings.push(`warning: showing first ${result.meta.returned} Linear projects`)
}
for (const error of result.meta.workspaceErrors ?? []) {
warnings.push(`warning: ${error.workspace.name} unavailable for Linear: ${error.message}`)
}
return warnings
}