mirror of
https://github.com/stablyai/orca.git
synced 2026-09-23 16:02:24 +00:00
Fixes STA-5076. list-issues capped at 50 by default and hard-clamped at 250, with hasMore buried under result.meta and no stderr warning for --json, so a page that stopped early read as a complete answer. Omitting --limit now walks Linear's pages until they run out (meta.limit is null), and --limit <n> is the only cap, paging past Linear's 250-per-request maximum to reach it. result.truncated sits next to result.issues and is set only when a cap actually held results back; human output prints "truncated: showing N". The read still has to fit the CLI's 60s RPC budget, so a 20s wall-clock deadline and a 200-page ceiling stop the walk early and report truncated with a continuation cursor rather than failing the command. Also: - issued --cursor values bind the resolved workspace, so call -> nextCursor -> call works without --workspace; raw Linear cursors still need one and now carry nextSteps - issued cursors whose payload smuggles back `all` or an empty workspace are rejected at decode, since either would widen the read past the bound workspace - JSON issue rows carry priorityLabel (none/urgent/high/medium/low), matching orca linear priority set - truncated and priorityLabel are optional on the wire, so a host that predates either is not read as "complete"; readers fall back to meta.hasMore - the truncation line prints the rows actually rendered, so a remote result with no meta.returned cannot print "showing undefined"
42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import type { LinearProjectListResult } from './agent-result-types'
|
|
import { appendLinearListTruncation } from './list-truncation-format'
|
|
|
|
// 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.'
|
|
}
|
|
const body = 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')
|
|
return appendLinearListTruncation(
|
|
body,
|
|
result.projects.length,
|
|
result.truncated ?? result.meta.hasMore
|
|
)
|
|
}
|
|
|
|
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
|
|
}
|