feat(linear): add MCP-style save issue (#9670)
* feat(linear): add MCP-style save issue * fix(linear): harden save issue parity * fix(linear): close save issue contract gaps * docs(linear): bundle project discovery with save issue
This commit is contained in:
@@ -1270,6 +1270,9 @@ export async function updateIssue(
|
||||
if (updates.projectId !== undefined) {
|
||||
payload.projectId = updates.projectId
|
||||
}
|
||||
if (updates.parentId !== undefined) {
|
||||
payload.parentId = updates.parentId
|
||||
}
|
||||
|
||||
const result = await entry.client.updateIssue(id, payload)
|
||||
if (!result.success) {
|
||||
@@ -1290,10 +1293,7 @@ export async function updateIssue(
|
||||
|
||||
export async function updateIssueForAgent(
|
||||
id: string,
|
||||
updates: Pick<
|
||||
LinearIssueUpdate,
|
||||
'stateId' | 'assigneeId' | 'priority' | 'estimate' | 'dueDate' | 'labelIds'
|
||||
>,
|
||||
updates: LinearIssueUpdate,
|
||||
workspaceId: string,
|
||||
options: { signal?: AbortSignal } = {}
|
||||
): Promise<LinearIssueWriteRecord> {
|
||||
@@ -1307,6 +1307,12 @@ export async function updateIssueForAgent(
|
||||
if (updates.stateId !== undefined) {
|
||||
payload.stateId = updates.stateId
|
||||
}
|
||||
if (updates.title !== undefined) {
|
||||
payload.title = updates.title
|
||||
}
|
||||
if (updates.description !== undefined) {
|
||||
payload.description = updates.description
|
||||
}
|
||||
if (updates.assigneeId !== undefined) {
|
||||
payload.assigneeId = updates.assigneeId
|
||||
}
|
||||
@@ -1322,6 +1328,12 @@ export async function updateIssueForAgent(
|
||||
if (updates.labelIds !== undefined) {
|
||||
payload.labelIds = updates.labelIds
|
||||
}
|
||||
if (updates.projectId !== undefined) {
|
||||
payload.projectId = updates.projectId
|
||||
}
|
||||
if (updates.parentId !== undefined) {
|
||||
payload.parentId = updates.parentId
|
||||
}
|
||||
const result = await client.updateIssue(id, payload)
|
||||
if (!result.success) {
|
||||
throw new LinearWriteFailure('failed', 'Linear update failed')
|
||||
|
||||
@@ -19,6 +19,8 @@ type TeamLabelNode = {
|
||||
type TeamMemberNode = {
|
||||
id: string
|
||||
displayName: string
|
||||
name?: string | null
|
||||
email?: string | null
|
||||
avatarUrl?: string | null
|
||||
}
|
||||
|
||||
@@ -89,6 +91,8 @@ export async function fetchAllTeamMembers(team: {
|
||||
return members.nodes.map((m) => ({
|
||||
id: m.id,
|
||||
displayName: m.displayName,
|
||||
name: m.name ?? undefined,
|
||||
email: m.email ?? undefined,
|
||||
avatarUrl: m.avatarUrl ?? undefined
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ type LinearUserNode = {
|
||||
|
||||
type LinearProjectNode = {
|
||||
id: string
|
||||
slugId?: string | null
|
||||
name: string
|
||||
description?: string | null
|
||||
content?: string | null
|
||||
@@ -188,6 +189,7 @@ export type LinearProjectCreateInput = {
|
||||
|
||||
const ORCA_PROJECT_FIELDS = `
|
||||
id
|
||||
slugId
|
||||
name
|
||||
description
|
||||
content
|
||||
@@ -605,6 +607,7 @@ function mapProjectForWorkspace(
|
||||
): LinearProjectSummary {
|
||||
return {
|
||||
id: project.id,
|
||||
slugId: project.slugId ?? undefined,
|
||||
workspaceId: entry.workspace.id,
|
||||
workspaceName: entry.workspace.organizationName,
|
||||
name: project.name,
|
||||
|
||||
@@ -29,6 +29,8 @@ type LabelNode = {
|
||||
type MemberNode = {
|
||||
id: string
|
||||
displayName: string
|
||||
name?: string | null
|
||||
email?: string | null
|
||||
avatarUrl?: string | null
|
||||
}
|
||||
|
||||
@@ -244,7 +246,7 @@ describe('Linear teams', () => {
|
||||
.fn()
|
||||
.mockResolvedValue(
|
||||
makeConnection([
|
||||
[makeMember('user-1', 'Ada')],
|
||||
[{ ...makeMember('user-1', 'Ada'), name: 'Ada Lovelace', email: 'ada@example.com' }],
|
||||
[makeMember('user-2', 'Grace')],
|
||||
[makeMember('user-3', 'Linus')]
|
||||
])
|
||||
@@ -254,9 +256,27 @@ describe('Linear teams', () => {
|
||||
const { getTeamMembersOrThrow } = await import('./teams')
|
||||
|
||||
await expect(getTeamMembersOrThrow('team-1', 'workspace-1')).resolves.toEqual([
|
||||
{ id: 'user-1', displayName: 'Ada', avatarUrl: undefined },
|
||||
{ id: 'user-2', displayName: 'Grace', avatarUrl: undefined },
|
||||
{ id: 'user-3', displayName: 'Linus', avatarUrl: undefined }
|
||||
{
|
||||
id: 'user-1',
|
||||
displayName: 'Ada',
|
||||
name: 'Ada Lovelace',
|
||||
email: 'ada@example.com',
|
||||
avatarUrl: undefined
|
||||
},
|
||||
{
|
||||
id: 'user-2',
|
||||
displayName: 'Grace',
|
||||
name: undefined,
|
||||
email: undefined,
|
||||
avatarUrl: undefined
|
||||
},
|
||||
{
|
||||
id: 'user-3',
|
||||
displayName: 'Linus',
|
||||
name: undefined,
|
||||
email: undefined,
|
||||
avatarUrl: undefined
|
||||
}
|
||||
])
|
||||
|
||||
expect(entry.client.team).toHaveBeenCalledWith('team-1')
|
||||
|
||||
Reference in New Issue
Block a user