-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Expand file tree
/
Copy pathcreate_project_status.ts
More file actions
147 lines (136 loc) · 3.38 KB
/
create_project_status.ts
File metadata and controls
147 lines (136 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import type {
LinearCreateProjectStatusParams,
LinearCreateProjectStatusResponse,
} from '@/tools/linear/types'
import type { ToolConfig } from '@/tools/types'
export const linearCreateProjectStatusTool: ToolConfig<
LinearCreateProjectStatusParams,
LinearCreateProjectStatusResponse
> = {
id: 'linear_create_project_status',
name: 'Linear Create Project Status',
description: 'Create a new project status in Linear',
version: '1.0.0',
oauth: {
required: true,
provider: 'linear',
},
params: {
name: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Project status name',
},
type: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Status type: "backlog", "planned", "started", "paused", "completed", or "canceled"',
},
color: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Status color (hex code)',
},
position: {
type: 'number',
required: true,
visibility: 'user-or-llm',
description: 'Position in status list (e.g. 0, 1, 2...)',
},
description: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Status description',
},
indefinite: {
type: 'boolean',
required: false,
visibility: 'user-or-llm',
description: 'Whether the status is indefinite',
},
},
request: {
url: 'https://api.linear.app/graphql',
method: 'POST',
headers: (params) => {
if (!params.accessToken) {
throw new Error('Missing access token for Linear API request')
}
return {
'Content-Type': 'application/json',
Authorization: `Bearer ${params.accessToken}`,
}
},
body: (params) => {
const input: Record<string, any> = {
name: params.name,
type: params.type,
color: params.color,
position: params.position,
}
if (params.description != null && params.description !== '') {
input.description = params.description
}
if (params.indefinite != null) {
input.indefinite = params.indefinite
}
return {
query: `
mutation ProjectStatusCreate($input: ProjectStatusCreateInput!) {
projectStatusCreate(input: $input) {
success
status {
id
name
description
color
indefinite
position
createdAt
archivedAt
}
}
}
`,
variables: {
input,
},
}
},
},
transformResponse: async (response) => {
const data = await response.json()
if (data.errors) {
return {
success: false,
error: data.errors[0]?.message || 'Failed to create project status',
output: {},
}
}
const result = data.data.projectStatusCreate
if (!result.success) {
return {
success: false,
error: 'Project status creation was not successful',
output: {},
}
}
return {
success: true,
output: {
projectStatus: result.status,
},
}
},
outputs: {
projectStatus: {
type: 'object',
description: 'The created project status',
},
},
}